R/stories.R

Defines functions asn_stories_delete asn_stories_update asn_stories_create_on_task asn_stories_find_by_id asn_stories_find_by_task

Documented in asn_stories_create_on_task asn_stories_delete asn_stories_find_by_id asn_stories_find_by_task asn_stories_update

# DO NOT EDIT MANUALLY - This file is autogenerated from Asana API Specs
#' Stories
#'
#'
#'  A _story_ represents an activity associated with an object in the Asana
#'  system. Stories are generated by the system whenever users take actions such
#'  as creating or assigning tasks, or moving tasks between projects. _Comments_
#'  are also a form of user-generated story.
#'  
#'  Stories are a form of history in the system, and as such they are read-only.
#'  Once generated, it is not possible to modify a story.
#' @name asn_stories
#' @rdname asn_stories
#' @family stories
#' @seealso \link{https://asana.com/developers/api-reference/stories}
NULL

#' Returns the compact records for all stories on the task.
#'
#' @param task  {Id} Globally unique identifier for the task.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family stories
asn_stories_find_by_task = function(task, ..., options = list()){
  path = sprintf("/tasks/%s/stories", task)
  asn_get(endpoint = path, ..., options = options)
}


#' Returns the full record for a single story.
#'
#' @param story  {Id} Globally unique identifier for the story.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family stories
asn_stories_find_by_id = function(story, ..., options = list()){
  path = sprintf("/stories/%s", story)
  asn_get(endpoint = path, ..., options = options)
}


#' Adds a comment to a task. The comment will be authored by the
#' currently authenticated user, and timestamped when the server receives
#' the request.
#' 
#' Returns the full record for the new story added to the task.
#'
#' @param task  {Id} Globally unique identifier for the task.#'
#' @param ...  {Object} Data for the request
#'    text : {String} The plain text of the comment to add.
#' @export
#' @family stories
asn_stories_create_on_task = function(task, ..., options = list()){
  path = sprintf("/tasks/%s/stories", task)
  asn_post(endpoint = path, ..., options = options)
}


#' Updates the story and returns the full record for the updated story.
#' Only comment stories can have their text updated, and only comment stories and
#' attachment stories can be pinned. Only one of `text` and `html_text` can be specified.
#'
#' @param story  {Id} Globally unique identifier for the story.#'
#' @param ...  {Object} Data for the request
#'    [text] : {String} The plain text with which to update the comment.
#'    [html_text] : {String} The rich text with which to update the comment.
#'    [is_pinned] : {Boolean} Whether the story should be pinned on the resource.
#' @export
#' @family stories
asn_stories_update = function(story, ..., options = list()){
  path = sprintf("/stories/%s", story)
  asn_put(endpoint = path, ..., options = options)
}


#' Deletes a story. A user can only delete stories they have created. Returns an empty data record.
#'
#' @param story  {Id} Globally unique identifier for the story.
#' @export
#' @family stories
asn_stories_delete = function(story, ..., options = list()){
  path = sprintf("/stories/%s", story)
  asn_delete(endpoint = path, ..., options = options)
}
datacamp/asana documentation built on Sept. 18, 2023, 8:51 a.m.