R/mining_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 Mining operations
#' @description binanceRapi.Mining
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ SapiV1MiningHashTransferConfigCancelPost } \emph{ Cancel Hashrate Resale configuration (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } config.id character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200110} \cr
#'
#'
#' \item status code : 200 | Success flag
#'
#' \item return type : InlineResponse200110 
#' \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{ SapiV1MiningHashTransferConfigDetailsListGet } \emph{ Hashrate Resale List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } page.index integer
#' \item \emph{ @param } page.size character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200107} \cr
#'
#'
#' \item status code : 200 | List of hashrate resales
#'
#' \item return type : InlineResponse200107 
#' \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{ SapiV1MiningHashTransferConfigPost } \emph{ Hashrate Resale Request (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } algo character
#' \item \emph{ @param } to.pool.user character
#' \item \emph{ @param } hash.rate character
#' \item \emph{ @param } start.date character
#' \item \emph{ @param } end.date character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200109} \cr
#'
#'
#' \item status code : 200 | Mining Account Id
#'
#' \item return type : InlineResponse200109 
#' \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{ SapiV1MiningHashTransferProfitDetailsGet } \emph{ Hashrate Resale Details (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } config.id character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } page.index integer
#' \item \emph{ @param } page.size character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200108} \cr
#'
#'
#' \item status code : 200 | List of hashrate resale details
#'
#' \item return type : InlineResponse200108 
#' \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{ SapiV1MiningPaymentListGet } \emph{ Earnings List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } coin character
#' \item \emph{ @param } start.date character
#' \item \emph{ @param } end.date character
#' \item \emph{ @param } page.index integer
#' \item \emph{ @param } page.size character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200105} \cr
#'
#'
#' \item status code : 200 | List of earnings
#'
#' \item return type : InlineResponse200105 
#' \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{ SapiV1MiningPaymentOtherGet } \emph{ Extra Bonus List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } coin character
#' \item \emph{ @param } start.date character
#' \item \emph{ @param } end.date character
#' \item \emph{ @param } page.index integer
#' \item \emph{ @param } page.size character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200106} \cr
#'
#'
#' \item status code : 200 | List of extra bonuses
#'
#' \item return type : InlineResponse200106
#' \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{ SapiV1MiningPaymentUidGet } \emph{ Mining Account Earning (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } timestamp integer
#' \item \emph{ @param } signature character
#' \item \emph{ @param } start.date character
#' \item \emph{ @param } end.date character
#' \item \emph{ @param } page.index integer
#' \item \emph{ @param } page.size character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200113} \cr
#'
#'
#' \item status code : 200 | Mining account earnings
#'
#' \item return type : InlineResponse200113  
#' \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{ SapiV1MiningPubAlgoListGet } \emph{ Acquiring Algorithm (MARKET_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200101} \cr
#'
#'
#' \item status code : 200 | Algorithm information
#'
#' \item return type : InlineResponse200101 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MiningPubCoinListGet } \emph{ Acquiring CoinName (MARKET_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200102} \cr
#'
#'
#' \item status code : 200 | Coin information
#'
#' \item return type : InlineResponse200102 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MiningStatisticsUserListGet } \emph{ Account List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200112} \cr
#'
#'
#' \item status code : 200 | List of mining accounts
#'
#' \item return type : InlineResponse200112 
#' \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{ SapiV1MiningStatisticsUserStatusGet } \emph{ Statistic List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200111} \cr
#'
#'
#' \item status code : 200 | Mining account statistics
#'
#' \item return type : InlineResponse200111 
#' \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{ SapiV1MiningWorkerDetailGet } \emph{ Request for Detail Miner List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } worker.name character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200103} \cr
#'
#'
#' \item status code : 200 | List of workers' hashrates'
#'
#' \item return type : InlineResponse200103 
#' \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{ SapiV1MiningWorkerListGet } \emph{ Request for Miner List (USER_DATA) }
#' Weight(IP): 5
#'
#' \itemize{
#' \item \emph{ @param } algo character
#' \item \emph{ @param } user.name character
#' \item \emph{ @param } page.index integer
#' \item \emph{ @param } sort integer
#' \item \emph{ @param } sort.column integer
#' \item \emph{ @param } worker.status integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200104} \cr
#'
#'
#' \item status code : 200 | List of workers
#'
#' \item return type : InlineResponse200104 
#' \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{
#' ####################  SapiV1MiningHashTransferConfigCancelPost  ####################
#'
#' library(binanceRapi)
#' var.config.id <- 'config.id_example' # character | Mining ID
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Cancel Hashrate Resale configuration (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningHashTransferConfigCancelPost(var.config.id, var.user.name, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningHashTransferConfigDetailsListGet  ####################
#'
#' library(binanceRapi)
#' var.page.index <- 56 # integer | Page number, default is first page, start form 1
#' var.page.size <- 'page.size_example' # character | Number of pages, minimum 10, maximum 200
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Hashrate Resale List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningHashTransferConfigDetailsListGet(page.index=var.page.index, page.size=var.page.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningHashTransferConfigPost  ####################
#'
#' library(binanceRapi)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.to.pool.user <- 'to.pool.user_example' # character | Mining Account
#' var.hash.rate <- 'hash.rate_example' # character | Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000)
#' var.start.date <- 'start.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.end.date <- 'end.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Hashrate Resale Request (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningHashTransferConfigPost(var.user.name, var.algo, var.to.pool.user, var.hash.rate, start.date=var.start.date, end.date=var.end.date, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningHashTransferProfitDetailsGet  ####################
#'
#' library(binanceRapi)
#' var.config.id <- 'config.id_example' # character | Mining ID
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.page.index <- 56 # integer | Page number, default is first page, start form 1
#' var.page.size <- 'page.size_example' # character | Number of pages, minimum 10, maximum 200
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Hashrate Resale Details (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningHashTransferProfitDetailsGet(var.config.id, var.user.name, page.index=var.page.index, page.size=var.page.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningPaymentListGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.coin <- 'BNB' # character | Coin name
#' var.start.date <- 'start.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.end.date <- 'end.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.page.index <- 56 # integer | Page number, default is first page, start form 1
#' var.page.size <- 'page.size_example' # character | Number of pages, minimum 10, maximum 200
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Earnings List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningPaymentListGet(var.algo, var.user.name, coin=var.coin, start.date=var.start.date, end.date=var.end.date, page.index=var.page.index, page.size=var.page.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningPaymentOtherGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.coin <- 'BNB' # character | Coin name
#' var.start.date <- 'start.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.end.date <- 'end.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.page.index <- 56 # integer | Page number, default is first page, start form 1
#' var.page.size <- 'page.size_example' # character | Number of pages, minimum 10, maximum 200
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Extra Bonus List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningPaymentOtherGet(var.algo, var.user.name, coin=var.coin, start.date=var.start.date, end.date=var.end.date, page.index=var.page.index, page.size=var.page.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningPaymentUidGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.start.date <- 'start.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.end.date <- 'end.date_example' # character | Search date, millisecond timestamp, while empty query all
#' var.page.index <- 56 # integer | Page number, default is first page, start form 1
#' var.page.size <- 'page.size_example' # character | Number of pages, minimum 10, maximum 200
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Mining Account Earning (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningPaymentUidGet(var.algo, start.date=var.start.date, end.date=var.end.date, page.index=var.page.index, page.size=var.page.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningPubAlgoListGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Acquiring Algorithm (MARKET_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningPubAlgoListGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningPubCoinListGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Acquiring CoinName (MARKET_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningPubCoinListGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningStatisticsUserListGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Account List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningStatisticsUserListGet(var.algo, var.user.name, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningStatisticsUserStatusGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Statistic List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningStatisticsUserStatusGet(var.algo, var.user.name, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningWorkerDetailGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.worker.name <- 'worker.name_example' # character | Miner’s name
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Request for Detail Miner List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningWorkerDetailGet(var.algo, var.user.name, var.worker.name, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MiningWorkerListGet  ####################
#'
#' library(binanceRapi)
#' var.algo <- 'algo_example' # character | Algorithm(sha256)
#' var.user.name <- 'user.name_example' # character | Mining Account
#' var.page.index <- 56 # integer | Page number, default is first page, start form 1
#' var.sort <- 56 # integer | sort sequence(default=0)0 positive sequence, 1 negative sequence
#' var.sort.column <- 56 # integer | Sort by( default 1): 1: miner name, 2: real-time computing power, 3: daily average computing power, 4: real-time rejection rate, 5: last submission time
#' var.worker.status <- 56 # integer | miners status(default=0)0 all, 1 valid, 2 invalid, 3 failure
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Request for Miner List (USER_DATA)
#' api.instance <- MiningApi$new()
#'
#' result <- api.instance$SapiV1MiningWorkerListGet(var.algo, var.user.name, page.index=var.page.index, sort=var.sort, sort.column=var.sort.column, worker.status=var.worker.status, recv.window=var.recv.window)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
MiningApi <- R6::R6Class(
  'MiningApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    SapiV1MiningHashTransferConfigCancelPost = function(config.id, user.name, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningHashTransferConfigCancelPostWithHttpInfo(config.id, user.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
      }
    },

    SapiV1MiningHashTransferConfigCancelPostWithHttpInfo = function(config.id, user.name, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['configId'] <- config.id

      queryParams['userName'] <- user.name

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/hash-transfer/config/cancel"
      # 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, "InlineResponse200110", 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)
      }
    },
    SapiV1MiningHashTransferConfigDetailsListGet = function(page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningHashTransferConfigDetailsListGetWithHttpInfo(page.index, page.size, 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
      }
    },

    SapiV1MiningHashTransferConfigDetailsListGetWithHttpInfo = function(page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['pageIndex'] <- page.index

      queryParams['pageSize'] <- page.size

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/hash-transfer/config/details/list"
      # 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, "InlineResponse200107", 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)
      }
    },
    SapiV1MiningHashTransferConfigPost = function(user.name, algo, to.pool.user, hash.rate, timestamp, signature, start.date=NULL, end.date=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningHashTransferConfigPostWithHttpInfo(user.name, algo, to.pool.user, hash.rate, timestamp, signature, start.date, end.date, 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
      }
    },

    SapiV1MiningHashTransferConfigPostWithHttpInfo = function(user.name, algo, to.pool.user, hash.rate,
                                                              start.date=NULL, end.date=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      if (missing(`to.pool.user`)) {
        stop("Missing required parameter `to.pool.user`.")
      }

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

      queryParams['userName'] <- user.name

      queryParams['algo'] <- algo

      queryParams['startDate'] <- start.date

      queryParams['endDate'] <- end.date

      queryParams['toPoolUser'] <- to.pool.user

      queryParams['hashRate'] <- hash.rate

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/hash-transfer/config"
      # 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, "InlineResponse200109", 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)
      }
    },
    SapiV1MiningHashTransferProfitDetailsGet = function(config.id, user.name, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningHashTransferProfitDetailsGetWithHttpInfo(config.id, user.name, 
                                                                               page.index, page.size, 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
      }
    },

    SapiV1MiningHashTransferProfitDetailsGetWithHttpInfo = function(config.id, user.name, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['configId'] <- config.id

      queryParams['userName'] <- user.name

      queryParams['pageIndex'] <- page.index

      queryParams['pageSize'] <- page.size

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/hash-transfer/profit/details"
      # 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, "InlineResponse200108", 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)
      }
    },
    SapiV1MiningPaymentListGet = function(algo, user.name, coin=NULL, start.date=NULL, end.date=NULL, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningPaymentListGetWithHttpInfo(algo, user.name, coin, start.date, end.date, page.index, page.size, 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
      }
    },

    SapiV1MiningPaymentListGetWithHttpInfo = function(algo, user.name, coin=NULL, start.date=NULL, end.date=NULL, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['algo'] <- algo

      queryParams['userName'] <- user.name

      queryParams['coin'] <- coin

      queryParams['startDate'] <- start.date

      queryParams['endDate'] <- end.date

      queryParams['pageIndex'] <- page.index

      queryParams['pageSize'] <- page.size

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/payment/list"
      # 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, "InlineResponse200105", 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)
      }
    },
    SapiV1MiningPaymentOtherGet = function(algo, user.name, coin=NULL, start.date=NULL, end.date=NULL, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningPaymentOtherGetWithHttpInfo(algo, user.name, coin, start.date, end.date, page.index, page.size, 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
      }
    },

    SapiV1MiningPaymentOtherGetWithHttpInfo = function(algo, user.name, coin=NULL, start.date=NULL, end.date=NULL, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['algo'] <- algo

      queryParams['userName'] <- user.name

      queryParams['coin'] <- coin

      queryParams['startDate'] <- start.date

      queryParams['endDate'] <- end.date

      queryParams['pageIndex'] <- page.index

      queryParams['pageSize'] <- page.size

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/payment/other"
      # 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, "InlineResponse200106", 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)
      }
    },
    SapiV1MiningPaymentUidGet = function(algo, start.date=NULL, end.date=NULL, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningPaymentUidGetWithHttpInfo(algo, start.date, end.date, page.index, page.size, 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
      }
    },
    
    SapiV1MiningPaymentUidGetWithHttpInfo = function(algo, start.date=NULL, end.date=NULL, page.index=NULL, page.size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()
      
      if (missing(`algo`)) {
        stop("Missing required parameter `algo`.")
      }
      
      queryParams['algo'] <- algo
      
      queryParams['startDate'] <- start.date
      
      queryParams['endDate'] <- end.date
      
      queryParams['pageIndex'] <- page.index
      
      queryParams['pageSize'] <- page.size
      
      queryParams['recvWindow'] <- recv.window
      
      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)
      
      body <- NULL
      urlPath <- "/sapi/v1/mining/payment/uid"
      # 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, "InlineResponse200113", 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)
      }
    },
    SapiV1MiningPubAlgoListGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningPubAlgoListGetWithHttpInfo(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
      }
    },

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

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/pub/algoList"
      # 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, "InlineResponse200101", 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)
      }
    },
    SapiV1MiningPubCoinListGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningPubCoinListGetWithHttpInfo(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
      }
    },

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

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/pub/coinList"
      # 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, "InlineResponse200102", 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)
      }
    },
    SapiV1MiningStatisticsUserListGet = function(algo, user.name, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningStatisticsUserListGetWithHttpInfo(algo, user.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
      }
    },

    SapiV1MiningStatisticsUserListGetWithHttpInfo = function(algo, user.name, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['algo'] <- algo

      queryParams['userName'] <- user.name

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/statistics/user/list"
      # 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, "InlineResponse200112", 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)
      }
    },
    SapiV1MiningStatisticsUserStatusGet = function(algo, user.name, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningStatisticsUserStatusGetWithHttpInfo(algo, user.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
      }
    },

    SapiV1MiningStatisticsUserStatusGetWithHttpInfo = function(algo, user.name, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['algo'] <- algo

      queryParams['userName'] <- user.name

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/statistics/user/status"
      # 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, "InlineResponse200111", 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)
      }
    },
    SapiV1MiningWorkerDetailGet = function(algo, user.name, worker.name, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningWorkerDetailGetWithHttpInfo(algo, user.name, worker.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
      }
    },

    SapiV1MiningWorkerDetailGetWithHttpInfo = function(algo, user.name, worker.name, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

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

      queryParams['algo'] <- algo

      queryParams['userName'] <- user.name

      queryParams['workerName'] <- worker.name

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/worker/detail"
      # 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, "InlineResponse200103", 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)
      }
    },
    SapiV1MiningWorkerListGet = function(algo, user.name, page.index=NULL, sort=NULL, sort.column=NULL, worker.status=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MiningWorkerListGetWithHttpInfo(algo, user.name, page.index, sort, sort.column, worker.status, 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
      }
    },

    SapiV1MiningWorkerListGetWithHttpInfo = function(algo, user.name, page.index=NULL, sort=NULL, sort.column=NULL, worker.status=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['algo'] <- algo

      queryParams['userName'] <- user.name

      queryParams['pageIndex'] <- page.index

      queryParams['sort'] <- sort

      queryParams['sortColumn'] <- sort.column

      queryParams['workerStatus'] <- worker.status

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/mining/worker/list"
      # 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, "InlineResponse200104", 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.