DoubleYouGTT / hubspot

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

Add support for Get all pipelines for a specified object type endpoint #91

Open maelle opened 4 years ago

maelle commented 4 years ago

Get all pipelines for a specified object type

R script template

#' WIP - Get all pipelines for a specified object type (raw and tidy)
#'
#' @description  ,Get all of the pipelines for the specified object type. This currently supports pipelines for deals and tickets. , from the [Get all pipelines for a specified object type endpoint](https://developers.hubspot.com/docs/methods/pipelines/get_pipelines_for_object_type).
#' @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  object_type ADD TO A TEMPLATE The object type that you want the pipelines for. Must be one of: deals tickets
#' @template  include_inactive ADD TO A TEMPLATE Whether or not to include inactive pipelines. Inactive pipelines and stages cannot be used when creating or updating objects. Must be one of: EXCLUDE_DELETED (default) INCLUDE_DELETED
#' @return A list (`hs_pipelines_for_a_specified_object_type_raw()`)
#' @rdname pipelines-for-a-specified-object-type
#' @export
#' @examples
#' \donttest{
#' hs_pipelines_for_a_specified_object_type_raw(o_auth_access_token_or_api_key, object_type, include_inactive)
#' }
hs_pipelines_for_a_specified_object_type_raw <- function(o_auth_access_token_or_api_key, object_type, include_inactive) {
  path <- "GET /crm-pipelines/v1/pipelines/:object_type"
}
# tidiers -----------------------------------------------------------------
#' @rdname pipelines-for-a-specified-object-type
#' @template pipelines_for_a_specified_object_type
#' @template view
#' @return A tibble with associated entities (`hs_pipelines_for_a_specified_object_type_tidy()`)
#' @export
hs_pipelines_for_a_specified_object_type_tidy <- function(pipelines_for_a_specified_object_type = hs_pipelines_for_a_specified_object_type_raw(),
                                                         view = "lalalala") {
  # view <- match.arg(view, c('lalalala'))

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

test template

vcr::use_cassette("hs_pipelines_for_a_specified_object_type_raw", {

  test_that("hs_pipelines_for_a_specified_object_type_raw works", {

    expect_is(hs_pipelines_for_a_specified_object_type_raw(), "list")

  })

})