Skip to content

Decide how faithful we want to be to the API #3

@richierocks

Description

@richierocks

If we want to be strict about having exact 1 to 1 mappings with the API, we should have

  1. list_projects() that calls GET /projects, and
  2. get_project() that calls GET /projects/project-id

The latter isn't that useful for data science, since I suspect you'll actually want to retrieve lots of projects at once to compare. I suggest instead having a higher level get_projects() that can return multiple projects at once. I think the pattern is:

#' @export
list_projects <- function(workspace, team, archived = FALSE) {
  # some input checking
  results <- call_asana_api("projects/", workspace = workspace, team = team, archived = archived)
  # some flattening ...
  flat_results
}

# internal only
get_project <- function(project_id) {
  # checks
  results <- call_asana_api("projects/", project_id)
  # flattening
  a_single_row_data_frame
}

#' @importFrom purrr map_df
#' @export
get_projects <- function(project_ids) {
  map_df(project_ids, get_project)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions