R/accounts.R

Defines functions get_accounts

Documented in get_accounts

#' Get accounts
#'
#' @return data frame of accounts the user has access to
#' @export
#'
#' @examples
#' \dontrun{
#' get_accounts()
#' }

get_accounts <- function() {
 url <- httr::modify_url(
   base_url(),
   path = "accounts"
 )
 
 content <- call_api(url)
 
 tibble::tibble(
   id = purrr::map_chr(content$data, "id"),
   type = purrr::map_chr(content$data, "type"),
   name = purrr::map_chr(content$data, c("attributes", "name")),
   timezone = purrr::map_chr(content$data, c("attributes", "timezone")),
   subscription = purrr::map_chr(content$data, c("attributes", "subscription"))
 )
}
henrywangnl/RLeadfeeder documentation built on Jan. 1, 2021, 3:17 a.m.