R/client.R

Defines functions process_sell get_sell

Documented in get_sell process_sell

#' GET sell
#'
#' Get request for building new endpoints.
#'
#' @param endpoint resource
#' @param ... Additional query arguments
#'
#' @return Tibble
#' @export
get_sell <- function(endpoint = NULL, verbose = FALSE, ...) {

  q = list(...)
  #print(q)
  sell_resp <- httr::GET(paste0(base_url(), endpoint),
                         sell_auth(),
                         query = q,
                         if (verbose) httr::verbose()
                         )

  httr::stop_for_status(sell_resp)
  process_sell(sell_resp)

}




#' Process sell
#'
#' Process get requests
#'
#' @param sell_resp Response from get call
process_sell <- function(sell_resp = NULL) {

  jsonlite::fromJSON(httr::content(sell_resp, "text"))

}
Cloud9Smart/sell documentation built on Nov. 12, 2020, 9:44 p.m.