DoubleYouGTT / hubspot

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

Add support for List blogs endpoint #89

Open maelle opened 4 years ago

maelle commented 4 years ago

List blogs

R script template

#' WIP - List blogs (raw and tidy)
#'
#' @description List all of the blogs for an account. Supports paging and filtering. from the [List blogs endpoint](https://developers.hubspot.com/docs/methods/blogv2/get_blogs).
#' @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  topic_id ADD TO A TEMPLATE The id of a topic you wish to filter blog posts by. Topic IDs can be found using the topics endpoint
#' @template  offset ADD TO A TEMPLATE The offset set to start returning rows from. Defaults to 0.
#' @template  created ADD TO A TEMPLATE exact, range, gt, gte, lt, lte - When the post was first created, in milliseconds since the epoch
#' @template  deleted_at ADD TO A TEMPLATE exact, gt, gte - When the post was deleted, in milliseconds since the epoch. Zero if the blog post was never deleted. Use a DELETE request to delete the post, do not set this directly
#' @template  name ADD TO A TEMPLATE exact, in - The internal name of the blog
#' @return A list (`hs_list_blogs_raw()`)
#' @rdname list-blogs
#' @export
#' @examples
#' \donttest{
#' hs_list_blogs_raw(o_auth_access_token_or_api_key, limit, topic_id, offset, created, deleted_at, name)
#' }
hs_list_blogs_raw <- function(o_auth_access_token_or_api_key, limit, topic_id, offset, created, deleted_at, name) {
  path <- "/content/api/v2/blogs"
}
# tidiers -----------------------------------------------------------------
#' @rdname list-blogs
#' @template list_blogs
#' @template view
#' @return A tibble with associated entities (`hs_list_blogs_tidy()`)
#' @export
hs_list_blogs_tidy <- function(list_blogs = hs_list_blogs_raw(),
                              view = "lalalala") {
  # view <- match.arg(view, c('lalalala'))

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

test template

vcr::use_cassette("hs_list_blogs_raw", {

  test_that("hs_list_blogs_raw works", {

    expect_is(hs_list_blogs_raw(), "list")

  })

})