R/addresses_api.R

# GraphSense API
#
# GraphSense API provides programmatic access to various ledgers' addresses, entities, blocks, transactions and tags for automated and highly efficient forensics tasks.
#
# The version of the OpenAPI document: 1.0.1
# Contact: contact@ikna.io
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title Addresses operations
#' @description graphsense.Addresses
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ GetAddress } \emph{ Get an address, optionally with tags }
#' 
#'
#' \itemize{
#' \item \emph{ @param } currency character
#' \item \emph{ @param } address character
#' \item \emph{ @returnType } \link{Address} \cr
#'
#'
#' \item status code : 200 | OK
#'
#' \item return type : Address 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetAddressEntity } \emph{ Get the entity of an address }
#' 
#'
#' \itemize{
#' \item \emph{ @param } currency character
#' \item \emph{ @param } address character
#' \item \emph{ @returnType } \link{Entity} \cr
#'
#'
#' \item status code : 200 | OK
#'
#' \item return type : Entity 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ListAddressLinks } \emph{ Get outgoing transactions between two addresses }
#' 
#'
#' \itemize{
#' \item \emph{ @param } currency character
#' \item \emph{ @param } address character
#' \item \emph{ @param } neighbor character
#' \item \emph{ @param } page character
#' \item \emph{ @param } pagesize integer
#' \item \emph{ @returnType } \link{Links} \cr
#'
#'
#' \item status code : 200 | OK
#'
#' \item return type : Links 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ListAddressNeighbors } \emph{ Get an address's neighbors in the address graph }
#' 
#'
#' \itemize{
#' \item \emph{ @param } currency character
#' \item \emph{ @param } address character
#' \item \emph{ @param } direction Enum < [in, out] > 
#' \item \emph{ @param } include.labels character
#' \item \emph{ @param } page character
#' \item \emph{ @param } pagesize integer
#' \item \emph{ @returnType } \link{NeighborAddresses} \cr
#'
#'
#' \item status code : 200 | OK
#'
#' \item return type : NeighborAddresses 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ListAddressTxs } \emph{ Get all transactions an address has been involved in }
#' 
#'
#' \itemize{
#' \item \emph{ @param } currency character
#' \item \emph{ @param } address character
#' \item \emph{ @param } page character
#' \item \emph{ @param } pagesize integer
#' \item \emph{ @returnType } \link{AddressTxs} \cr
#'
#'
#' \item status code : 200 | OK
#'
#' \item return type : AddressTxs 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ListTagsByAddress } \emph{ Get attribution tags for a given address }
#' 
#'
#' \itemize{
#' \item \emph{ @param } currency character
#' \item \emph{ @param } address character
#' \item \emph{ @param } page character
#' \item \emph{ @param } pagesize integer
#' \item \emph{ @returnType } \link{AddressTags} \cr
#'
#'
#' \item status code : 200 | OK
#'
#' \item return type : AddressTags 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  GetAddress  ####################
#'
#' library(graphsense)
#' var.currency <- 'btc' # character | The cryptocurrency code (e.g., btc)
#' var.address <- 'addressA' # character | The cryptocurrency address
#'
#' #Get an address, optionally with tags
#' api.instance <- AddressesApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['Authorization'] <- 'WRITE_YOUR_API_KEY_HERE';
#'
#' result <- api.instance$GetAddress(var.currency, var.address)
#'
#'
#' ####################  GetAddressEntity  ####################
#'
#' library(graphsense)
#' var.currency <- 'btc' # character | The cryptocurrency code (e.g., btc)
#' var.address <- 'addressA' # character | The cryptocurrency address
#'
#' #Get the entity of an address
#' api.instance <- AddressesApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['Authorization'] <- 'WRITE_YOUR_API_KEY_HERE';
#'
#' result <- api.instance$GetAddressEntity(var.currency, var.address)
#'
#'
#' ####################  ListAddressLinks  ####################
#'
#' library(graphsense)
#' var.currency <- 'btc' # character | The cryptocurrency code (e.g., btc)
#' var.address <- 'addressA' # character | The cryptocurrency address
#' var.neighbor <- 'addressE' # character | Neighbor address
#' var.page <- 'page_example' # character | Resumption token for retrieving the next page
#' var.pagesize <- 10 # integer | Number of items returned in a single page
#'
#' #Get outgoing transactions between two addresses
#' api.instance <- AddressesApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['Authorization'] <- 'WRITE_YOUR_API_KEY_HERE';
#'
#' result <- api.instance$ListAddressLinks(var.currency, var.address, var.neighbor, page=var.page, pagesize=var.pagesize)
#'
#'
#' ####################  ListAddressNeighbors  ####################
#'
#' library(graphsense)
#' var.currency <- 'btc' # character | The cryptocurrency code (e.g., btc)
#' var.address <- 'addressA' # character | The cryptocurrency address
#' var.direction <- 'out' # character | Incoming or outgoing neighbors
#' var.include.labels <- FALSE # character | Whether to include labels of first page of tags
#' var.page <- 'page_example' # character | Resumption token for retrieving the next page
#' var.pagesize <- 10 # integer | Number of items returned in a single page
#'
#' #Get an address's neighbors in the address graph
#' api.instance <- AddressesApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['Authorization'] <- 'WRITE_YOUR_API_KEY_HERE';
#'
#' result <- api.instance$ListAddressNeighbors(var.currency, var.address, var.direction, include.labels=var.include.labels, page=var.page, pagesize=var.pagesize)
#'
#'
#' ####################  ListAddressTxs  ####################
#'
#' library(graphsense)
#' var.currency <- 'btc' # character | The cryptocurrency code (e.g., btc)
#' var.address <- 'addressA' # character | The cryptocurrency address
#' var.page <- 'page_example' # character | Resumption token for retrieving the next page
#' var.pagesize <- 10 # integer | Number of items returned in a single page
#'
#' #Get all transactions an address has been involved in
#' api.instance <- AddressesApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['Authorization'] <- 'WRITE_YOUR_API_KEY_HERE';
#'
#' result <- api.instance$ListAddressTxs(var.currency, var.address, page=var.page, pagesize=var.pagesize)
#'
#'
#' ####################  ListTagsByAddress  ####################
#'
#' library(graphsense)
#' var.currency <- 'btc' # character | The cryptocurrency code (e.g., btc)
#' var.address <- 'addressA' # character | The cryptocurrency address
#' var.page <- 'page_example' # character | Resumption token for retrieving the next page
#' var.pagesize <- 10 # integer | Number of items returned in a single page
#'
#' #Get attribution tags for a given address
#' api.instance <- AddressesApi$new()
#'
#' #Configure API key authorization: api_key
#' api.instance$apiClient$apiKeys['Authorization'] <- 'WRITE_YOUR_API_KEY_HERE';
#'
#' result <- api.instance$ListTagsByAddress(var.currency, var.address, page=var.page, pagesize=var.pagesize)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
AddressesApi <- R6::R6Class(
  'AddressesApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    GetAddress = function(currency, address, ...){
      apiResponse <- self$GetAddressWithHttpInfo(currency, address, ...)
      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
      }
    },

    GetAddressWithHttpInfo = function(currency, address, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      body <- NULL
      urlPath <- "/{currency}/addresses/{address}"
      if (!missing(`currency`)) {
        urlPath <- gsub(paste0("\\{", "currency", "\\}"), URLencode(as.character(`currency`), reserved = TRUE), urlPath)
      }

      if (!missing(`address`)) {
        urlPath <- gsub(paste0("\\{", "address", "\\}"), URLencode(as.character(`address`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("Authorization" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["Authorization"]) > 0) {
        headerParams['Authorization'] <- paste(unlist(self$apiClient$apiKeys["Authorization"]), collapse='')
      }

      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, "Address", loadNamespace("graphsense")),
          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)
      }
    },
    GetAddressEntity = function(currency, address, ...){
      apiResponse <- self$GetAddressEntityWithHttpInfo(currency, address, ...)
      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
      }
    },

    GetAddressEntityWithHttpInfo = function(currency, address, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      body <- NULL
      urlPath <- "/{currency}/addresses/{address}/entity"
      if (!missing(`currency`)) {
        urlPath <- gsub(paste0("\\{", "currency", "\\}"), URLencode(as.character(`currency`), reserved = TRUE), urlPath)
      }

      if (!missing(`address`)) {
        urlPath <- gsub(paste0("\\{", "address", "\\}"), URLencode(as.character(`address`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("Authorization" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["Authorization"]) > 0) {
        headerParams['Authorization'] <- paste(unlist(self$apiClient$apiKeys["Authorization"]), collapse='')
      }

      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, "Entity", loadNamespace("graphsense")),
          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)
      }
    },
    ListAddressLinks = function(currency, address, neighbor, page=NULL, pagesize=NULL, ...){
      apiResponse <- self$ListAddressLinksWithHttpInfo(currency, address, neighbor, page, pagesize, ...)
      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
      }
    },

    ListAddressLinksWithHttpInfo = function(currency, address, neighbor, page=NULL, pagesize=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

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

      queryParams['neighbor'] <- neighbor

      queryParams['page'] <- page

      queryParams['pagesize'] <- pagesize

      body <- NULL
      urlPath <- "/{currency}/addresses/{address}/links"
      if (!missing(`currency`)) {
        urlPath <- gsub(paste0("\\{", "currency", "\\}"), URLencode(as.character(`currency`), reserved = TRUE), urlPath)
      }

      if (!missing(`address`)) {
        urlPath <- gsub(paste0("\\{", "address", "\\}"), URLencode(as.character(`address`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("Authorization" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["Authorization"]) > 0) {
        headerParams['Authorization'] <- paste(unlist(self$apiClient$apiKeys["Authorization"]), collapse='')
      }

      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, "Links", loadNamespace("graphsense")),
          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)
      }
    },
    ListAddressNeighbors = function(currency, address, direction, include.labels=FALSE, page=NULL, pagesize=NULL, ...){
      apiResponse <- self$ListAddressNeighborsWithHttpInfo(currency, address, direction, include.labels, page, pagesize, ...)
      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
      }
    },

    ListAddressNeighborsWithHttpInfo = function(currency, address, direction, include.labels=FALSE, page=NULL, pagesize=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

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

      queryParams['direction'] <- direction

      queryParams['include_labels'] <- include.labels

      queryParams['page'] <- page

      queryParams['pagesize'] <- pagesize

      body <- NULL
      urlPath <- "/{currency}/addresses/{address}/neighbors"
      if (!missing(`currency`)) {
        urlPath <- gsub(paste0("\\{", "currency", "\\}"), URLencode(as.character(`currency`), reserved = TRUE), urlPath)
      }

      if (!missing(`address`)) {
        urlPath <- gsub(paste0("\\{", "address", "\\}"), URLencode(as.character(`address`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("Authorization" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["Authorization"]) > 0) {
        headerParams['Authorization'] <- paste(unlist(self$apiClient$apiKeys["Authorization"]), collapse='')
      }

      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, "NeighborAddresses", loadNamespace("graphsense")),
          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)
      }
    },
    ListAddressTxs = function(currency, address, page=NULL, pagesize=NULL, ...){
      apiResponse <- self$ListAddressTxsWithHttpInfo(currency, address, page, pagesize, ...)
      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
      }
    },

    ListAddressTxsWithHttpInfo = function(currency, address, page=NULL, pagesize=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['page'] <- page

      queryParams['pagesize'] <- pagesize

      body <- NULL
      urlPath <- "/{currency}/addresses/{address}/txs"
      if (!missing(`currency`)) {
        urlPath <- gsub(paste0("\\{", "currency", "\\}"), URLencode(as.character(`currency`), reserved = TRUE), urlPath)
      }

      if (!missing(`address`)) {
        urlPath <- gsub(paste0("\\{", "address", "\\}"), URLencode(as.character(`address`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("Authorization" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["Authorization"]) > 0) {
        headerParams['Authorization'] <- paste(unlist(self$apiClient$apiKeys["Authorization"]), collapse='')
      }

      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, "AddressTxs", loadNamespace("graphsense")),
          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)
      }
    },
    ListTagsByAddress = function(currency, address, page=NULL, pagesize=NULL, ...){
      apiResponse <- self$ListTagsByAddressWithHttpInfo(currency, address, page, pagesize, ...)
      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
      }
    },

    ListTagsByAddressWithHttpInfo = function(currency, address, page=NULL, pagesize=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['page'] <- page

      queryParams['pagesize'] <- pagesize

      body <- NULL
      urlPath <- "/{currency}/addresses/{address}/tags"
      if (!missing(`currency`)) {
        urlPath <- gsub(paste0("\\{", "currency", "\\}"), URLencode(as.character(`currency`), reserved = TRUE), urlPath)
      }

      if (!missing(`address`)) {
        urlPath <- gsub(paste0("\\{", "address", "\\}"), URLencode(as.character(`address`), reserved = TRUE), urlPath)
      }

      # API key authentication
      if ("Authorization" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["Authorization"]) > 0) {
        headerParams['Authorization'] <- paste(unlist(self$apiClient$apiKeys["Authorization"]), collapse='')
      }

      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, "AddressTags", loadNamespace("graphsense")),
          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)
      }
    }
  )
)
graphsense/rgraphsense documentation built on Sept. 2, 2022, 1:45 p.m.