DoubleYouGTT / hubspot

R package 📦 for working with Hubspot 👩‍💼👨‍💼 data
https://itsalocke.com/hubspot/
Other
10 stars 8 forks source link

Add support for List pages endpoint #90

Open maelle opened 4 years ago

maelle commented 4 years ago

List pages

R script template

#' WIP - List pages (raw and tidy)
#'
#' @description Get all of your pages. Supports paging and filtering. from the [List pages endpoint](https://developers.hubspot.com/docs/methods/pages/get_pages).
#' @details Required scope(s) for the OAuth token: none.
#' @template token_path
#' @template apikey
#' @template  o_auth_access_token_or_api_key ADD TO A TEMPLATE Used to authenticate the request. Please see this page for more details about authentication.
#' @template  limit ADD TO A TEMPLATE The number of items to return.  Defaults to 20
#' @template  offset ADD TO A TEMPLATE The offset set to start returning rows from. Defaults to 0.
#' @template  ab_test_id ADD TO A TEMPLATE exact
#' @template  archived ADD TO A TEMPLATE exact
#' @template  campaign ADD TO A TEMPLATE exact
#' @template  created ADD TO A TEMPLATE exact, range, gt, gte, lt, lte
#' @template  deleted_at ADD TO A TEMPLATE exact, gt, lt
#' @template  id ADD TO A TEMPLATE exact, in
#' @template  is_draft ADD TO A TEMPLATE exact
#' @template  name ADD TO A TEMPLATE exact, in, icontains
#' @template  publish_date ADD TO A TEMPLATE exact, range, gt, gte, lt, lte
#' @template  slug ADD TO A TEMPLATE exact, in
#' @template  subcategory ADD TO A TEMPLATE exact, in
#' @template  updated ADD TO A TEMPLATE exact, range, gt, gte, lt, lte
#' @return A list (`hs_list_pages_raw()`)
#' @rdname list-pages
#' @export
#' @examples
#' \donttest{
#' hs_list_pages_raw(o_auth_access_token_or_api_key, limit, offset, ab_test_id, archived, campaign, created, deleted_at, id, is_draft, name, publish_date, slug, subcategory, updated)
#' }
hs_list_pages_raw <- function(o_auth_access_token_or_api_key, limit, offset, ab_test_id, archived, campaign, created, deleted_at, id, is_draft, name, publish_date, slug, subcategory, updated) {
  path <- "/content/api/v2/pages"
}
# tidiers -----------------------------------------------------------------
#' @rdname list-pages
#' @template list_pages
#' @template view
#' @return A tibble with associated entities (`hs_list_pages_tidy()`)
#' @export
hs_list_pages_tidy <- function(list_pages = hs_list_pages_raw(),
                              view = "lalalala") {
  # view <- match.arg(view, c('lalalala'))

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

test template

vcr::use_cassette("hs_list_pages_raw", {

  test_that("hs_list_pages_raw works", {

    expect_is(hs_list_pages_raw(), "list")

  })

})