R/tags.R

Defines functions asn_tags_get_tasks_with_tag asn_tags_find_by_workspace asn_tags_find_all asn_tags_delete asn_tags_update asn_tags_find_by_id asn_tags_create_in_workspace asn_tags_create

Documented in asn_tags_create asn_tags_create_in_workspace asn_tags_delete asn_tags_find_all asn_tags_find_by_id asn_tags_find_by_workspace asn_tags_get_tasks_with_tag asn_tags_update

# DO NOT EDIT MANUALLY - This file is autogenerated from Asana API Specs
#' Tags
#'
#'
#'  A _tag_ is a label that can be attached to any task in Asana. It exists in a
#'  single workspace or organization.
#'  
#'  Tags have some metadata associated with them, but it is possible that we will
#'  simplify them in the future so it is not encouraged to rely too heavily on it.
#'  Unlike projects, tags do not provide any ordering on the tasks they
#'  are associated with.
#' @name asn_tags
#' @rdname asn_tags
#' @family tags
#' @seealso \link{https://asana.com/developers/api-reference/tags}
NULL

#' Creates a new tag in a workspace or organization.
#' 
#' Every tag is required to be created in a specific workspace or
#' organization, and this cannot be changed once set. Note that you can use
#' the `workspace` parameter regardless of whether or not it is an
#' organization.
#' 
#' Returns the full record of the newly created tag.
#'
#' @param ...  {Object} Data for the request
#'    workspace : {Id} The workspace or organization to create the tag in.
#' @export
#' @family tags
asn_tags_create = function(..., options = list()){
  path =  "/tags"
  asn_post(endpoint = path, ..., options = options)
}


#' Creates a new tag in a workspace or organization.
#' 
#' Every tag is required to be created in a specific workspace or
#' organization, and this cannot be changed once set. Note that you can use
#' the `workspace` parameter regardless of whether or not it is an
#' organization.
#' 
#' Returns the full record of the newly created tag.
#'
#' @param workspace  {Id} The workspace or organization to create the tag in.#'
#' @param ...  {Object} Data for the request
#' @export
#' @family tags
asn_tags_create_in_workspace = function(workspace, ..., options = list()){
  path = sprintf("/workspaces/%s/tags", workspace)
  asn_post(endpoint = path, ..., options = options)
}


#' Returns the complete tag record for a single tag.
#'
#' @param tag  {Id} The tag to get.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family tags
asn_tags_find_by_id = function(tag, ..., options = list()){
  path = sprintf("/tags/%s", tag)
  asn_get(endpoint = path, ..., options = options)
}


#' Updates the properties of a tag. Only the fields provided in the `data`
#' block will be updated; any unspecified fields will remain unchanged.
#' 
#' When using this method, it is best to specify only those fields you wish
#' to change, or else you may overwrite changes made by another user since
#' you last retrieved the task.
#' 
#' Returns the complete updated tag record.
#'
#' @param tag  {Id} The tag to update.#'
#' @param ...  {Object} Data for the request
#' @export
#' @family tags
asn_tags_update = function(tag, ..., options = list()){
  path = sprintf("/tags/%s", tag)
  asn_put(endpoint = path, ..., options = options)
}


#' A specific, existing tag can be deleted by making a DELETE request
#' on the URL for that tag.
#' 
#' Returns an empty data record.
#'
#' @param tag  {Id} The tag to delete.
#' @export
#' @family tags
asn_tags_delete = function(tag, ..., options = list()){
  path = sprintf("/tags/%s", tag)
  asn_delete(endpoint = path, ..., options = options)
}


#' Returns the compact tag records for some filtered set of tags.
#' Use one or more of the parameters provided to filter the tags returned.
#'
#' @param ...  {Object} Parameters for the request
#'    [workspace] : {Id} The workspace or organization to filter tags on.
#'    [team] : {Id} The team to filter tags on.
#'    [archived] : {Boolean} Only return tags whose `archived` field takes on the value of
#'    this parameter.
#' @export
#' @family tags
asn_tags_find_all = function(..., options = list()){
  path =  "/tags"
  asn_get(endpoint = path, ..., options = options)
}


#' Returns the compact tag records for all tags in the workspace.
#'
#' @param workspace  {Id} The workspace or organization to find tags in.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family tags
asn_tags_find_by_workspace = function(workspace, ..., options = list()){
  path = sprintf("/workspaces/%s/tags", workspace)
  asn_get(endpoint = path, ..., options = options)
}


#' Returns the compact task records for all tasks with the given tag.
#' Tasks can have more than one tag at a time.
#'
#' @param tag  {Id} The tag to fetch tasks from.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family tags
asn_tags_get_tasks_with_tag = function(tag, ..., options = list()){
  path = sprintf("/tags/%s/tasks", tag)
  asn_get(endpoint = path, ..., options = options)
}
datacamp/asana documentation built on Sept. 18, 2023, 8:51 a.m.