R/sections.R

Defines functions asn_sections_insert_in_project asn_sections_delete asn_sections_update asn_sections_find_by_id asn_sections_find_by_project asn_sections_create_in_project

Documented in asn_sections_create_in_project asn_sections_delete asn_sections_find_by_id asn_sections_find_by_project asn_sections_insert_in_project asn_sections_update

# DO NOT EDIT MANUALLY - This file is autogenerated from Asana API Specs
#' Sections
#'
#'
#'  A _section_ is a subdivision of a project that groups tasks together. It can
#'  either be a header above a list of tasks in a list view or a column in a
#'  board view of a project.
#' @name asn_sections
#' @rdname asn_sections
#' @family sections
#' @seealso \link{https://asana.com/developers/api-reference/sections}
NULL

#' Creates a new section in a project.
#' 
#' Returns the full record of the newly created section.
#'
#' @param project  {Id} The project to create the section in#'
#' @param ...  {Object} Data for the request
#'    name : {String} The text to be displayed as the section name. This cannot be an empty string.
#' @export
#' @family sections
asn_sections_create_in_project = function(project, ..., options = list()){
  path = sprintf("/projects/%s/sections", project)
  asn_post(endpoint = path, ..., options = options)
}


#' Returns the compact records for all sections in the specified project.
#'
#' @param project  {Id} The project to get sections from.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family sections
asn_sections_find_by_project = function(project, ..., options = list()){
  path = sprintf("/projects/%s/sections", project)
  asn_get(endpoint = path, ..., options = options)
}


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


#' A specific, existing section can be updated by making a PUT request on
#' the URL for that project. Only the fields provided in the `data` block
#' will be updated; any unspecified fields will remain unchanged. (note that
#' at this time, the only field that can be updated is the `name` field.)
#' 
#' 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 section record.
#'
#' @param section  {Id} The section to update.#'
#' @param ...  {Object} Data for the request
#' @export
#' @family sections
asn_sections_update = function(section, ..., options = list()){
  path = sprintf("/sections/%s", section)
  asn_put(endpoint = path, ..., options = options)
}


#' A specific, existing section can be deleted by making a DELETE request
#' on the URL for that section.
#' 
#' Note that sections must be empty to be deleted.
#' 
#' The last remaining section in a board view cannot be deleted.
#' 
#' Returns an empty data block.
#'
#' @param section  {Id} The section to delete.
#' @export
#' @family sections
asn_sections_delete = function(section, ..., options = list()){
  path = sprintf("/sections/%s", section)
  asn_delete(endpoint = path, ..., options = options)
}


#' Move sections relative to each other in a board view. One of
#' `before_section` or `after_section` is required.
#' 
#' Sections cannot be moved between projects.
#' 
#' At this point in time, moving sections is not supported in list views, only board views.
#' 
#' Returns an empty data block.
#'
#' @param project  {Id} The project in which to reorder the given section#'
#' @param ...  {Object} Data for the request
#'    section : {Id} The section to reorder
#'    [before_section] : {Id} Insert the given section immediately before the section specified by this parameter.
#'    [after_section] : {Id} Insert the given section immediately after the section specified by this parameter.
#' @export
#' @family sections
asn_sections_insert_in_project = function(project, ..., options = list()){
  path = sprintf("/projects/%s/sections/insert", project)
  asn_post(endpoint = path, ..., options = options)
}
datacamp/asana documentation built on Sept. 18, 2023, 8:51 a.m.