Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Get all tickets endpoint #96

Open
9 tasks
maelle opened this issue Jan 20, 2020 · 2 comments
Open
9 tasks

Add support for Get all tickets endpoint #96

maelle opened this issue Jan 20, 2020 · 2 comments

Comments

@maelle
Copy link
Contributor

maelle commented Jan 20, 2020

Get all tickets

  • Update master and create a new git branch
  • Create script (use_r('tickets') + scaffold below)
  • devtools::load_all() for trying
  • Add/update templates under man-roxygen/
  • devtools::document() for Rd and NAMESPACE updating
  • Add entry to pkgdown config
  • Add test (use_test('tickets'))
  • Add NEWS entry
  • Open PR referencing this issue

R script template

#' WIP - Get all tickets (raw and tidy)
#'
#' @description Get all tickets from a portal, up to 100 per request. from the [Get all tickets endpoint](https://developers.hubspot.com/docs/methods/tickets/get-all-tickets).
#' @details Required scope(s) for the OAuth token: tickets.
#' @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  offset ADD TO A TEMPLATE Used to get the next set of results. Check the value of hasMore in the response to see if there are more tickets to get. If hasMore is true, you use the returned offset value in the &offset= parameter of the next request to get the next set of records.
#' @template  ticket_properties ADD TO A TEMPLATE By default, only the ID and a few other system fields are returned for the tickets. You can include ticket properties in the response by requesting them in the URL. This parameter can be included multiple times to request multiple properties. See the example for more details.
#' @template  ticket_properties_with_history ADD TO A TEMPLATE This parameter behaves exactly like the properties parameter above, with the exception that properties included with this parameter also return the full version history for the property.
#' @return A list (`hs_tickets_raw()`)
#' @rdname tickets
#' @export
#' @examples
#' \donttest{
#' hs_tickets_raw(o_auth_access_token_or_api_key, offset, ticket_properties, ticket_properties_with_history)
#' }
hs_tickets_raw <- function(o_auth_access_token_or_api_key, offset, ticket_properties, ticket_properties_with_history) {
  path <- "GET  /crm-objects/v1/objects/tickets/paged"
}
# tidiers -----------------------------------------------------------------
#' @rdname tickets
#' @template tickets
#' @template view
#' @return A tibble with associated entities (`hs_tickets_tidy()`)
#' @export
hs_tickets_tidy <- function(tickets = hs_tickets_raw(),
                           view = "lalalala") {
  # view <- match.arg(view, c('lalalala'))

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

test template

vcr::use_cassette("hs_tickets_raw", {

  test_that("hs_tickets_raw works", {

    expect_is(hs_tickets_raw(), "list")

  })

})
@maelle
Copy link
Contributor Author

maelle commented Jan 20, 2020

Not sure where the ticket properties would come from (Hubspot knowledge maybe... there is apparently no ticket properties endpoint like the contact properties endpoint).

@cspenn
Copy link

cspenn commented Jan 28, 2020

It's in beta, apparently.

https://developers.hubspot.com/docs-beta/crm/tickets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants