DoubleYouGTT / hubspot

R package πŸ“¦ for working with Hubspot πŸ‘©β€πŸ’ΌπŸ‘¨β€πŸ’Ό data
https://itsalocke.com/hubspot/
Other
10 stars 8 forks source link

Add support for Get contacts in a list endpoint #88

Open maelle opened 4 years ago

maelle commented 4 years ago

Get contacts in a list

R script template

#' WIP - Get contacts in a list (raw and tidy)
#'
#' @description For a given portal and a given list, identified by its unique ID, return a list of contacts that are in that list. from the [Get contacts in a list endpoint](https://developers.hubspot.com/docs/methods/lists/get_list_contacts).
#' @details Required scope(s) for the OAuth token: none.
#' @template token_path
#' @template apikey
#'
#' @return A list (`hs_get_contacts_in_a_list_raw()`)
#' @rdname get-contacts-in-a-list
#' @export
#' @examples
#' \donttest{
#' hs_get_contacts_in_a_list_raw()
#' }
hs_get_contacts_in_a_list_raw <- function() {
  path <- " /contacts/v1/lists/:list_id/contacts/all"
}
# tidiers -----------------------------------------------------------------
#' @rdname get-contacts-in-a-list
#' @template get_contacts_in_a_list
#' @template view
#' @return A tibble with associated entities (`hs_get_contacts_in_a_list_tidy()`)
#' @export
hs_get_contacts_in_a_list_tidy <- function(get_contacts_in_a_list = hs_get_contacts_in_a_list_raw(),
                                          view = "lalalala") {
  # view <- match.arg(view, c('lalalala'))

  # switch(view,
  #       'lalalala' = blabla)
}

test template

vcr::use_cassette("hs_get_contacts_in_a_list_raw", {

  test_that("hs_get_contacts_in_a_list_raw works", {

    expect_is(hs_get_contacts_in_a_list_raw(), "list")

  })

})
maelle commented 4 years ago

Here, the automatic naming is not very good, so the functions etc. should be renamed.