R/teams.R

Defines functions asn_teams_remove_user asn_teams_add_user asn_teams_users asn_teams_find_by_user asn_teams_find_by_organization asn_teams_find_by_id

Documented in asn_teams_add_user asn_teams_find_by_id asn_teams_find_by_organization asn_teams_find_by_user asn_teams_remove_user asn_teams_users

# DO NOT EDIT MANUALLY - This file is autogenerated from Asana API Specs
#' Teams
#'
#'
#'  A _team_ is used to group related projects and people together within an
#'  organization. Each project in an organization is associated with a team.
#' @name asn_teams
#' @rdname asn_teams
#' @family teams
#' @seealso \link{https://asana.com/developers/api-reference/teams}
NULL

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


#' Returns the compact records for all teams in the organization visible to
#' the authorized user.
#'
#' @param organization  {Id} Globally unique identifier for the workspace or organization.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family teams
asn_teams_find_by_organization = function(organization, ..., options = list()){
  path = sprintf("/organizations/%s/teams", organization)
  asn_get(endpoint = path, ..., options = options)
}


#' Returns the compact records for all teams to which user is assigned.
#'
#' @param user  {String} An identifier for the user. Can be one of an email address,
#' @param the globally unique identifier for the user, or the keyword `me`
#' @param to indicate the current user making the request.#'
#' @param ...  {Object} Parameters for the request
#'    [organization] : {Id} The workspace or organization to filter teams on.
#' @export
#' @family teams
asn_teams_find_by_user = function(user, ..., options = list()){
  path = sprintf("/users/%s/teams", user)
  asn_get(endpoint = path, ..., options = options)
}


#' Returns the compact records for all users that are members of the team.
#'
#' @param team  {Id} Globally unique identifier for the team.#'
#' @param ...  {Object} Parameters for the request
#' @export
#' @family teams
asn_teams_users = function(team, ..., options = list()){
  path = sprintf("/teams/%s/users", team)
  asn_get(endpoint = path, ..., options = options)
}


#' The user making this call must be a member of the team in order to add others.
#' The user to add must exist in the same organization as the team in order to be added.
#' The user to add can be referenced by their globally unique user ID or their email address.
#' Returns the full user record for the added user.
#'
#' @param team  {Id} Globally unique identifier for the team.#'
#' @param ...  {Object} Data for the request
#'    user : {String} An identifier for the user. Can be one of an email address,
#'    the globally unique identifier for the user, or the keyword `me`
#'    to indicate the current user making the request.
#' @export
#' @family teams
asn_teams_add_user = function(team, ..., options = list()){
  path = sprintf("/teams/%s/addUser", team)
  asn_post(endpoint = path, ..., options = options)
}


#' The user to remove can be referenced by their globally unique user ID or their email address.
#' Removes the user from the specified team. Returns an empty data record.
#'
#' @param team  {Id} Globally unique identifier for the team.#'
#' @param ...  {Object} Data for the request
#'    user : {String} An identifier for the user. Can be one of an email address,
#'    the globally unique identifier for the user, or the keyword `me`
#'    to indicate the current user making the request.
#' @export
#' @family teams
asn_teams_remove_user = function(team, ..., options = list()){
  path = sprintf("/teams/%s/removeUser", team)
  asn_post(endpoint = path, ..., options = options)
}
datacamp/asana documentation built on Sept. 18, 2023, 8:51 a.m.