Skip to contents

R6 Class representing a central resource for managing divisions.

Super class

sevenbridges2::Item -> Division

Public fields

URL

List of URL endpoints for this resource.

id

The ID of the division.

name

Division's name.

Methods


Method new()

Create a new Division object.

Usage

Division$new(res = NA, ...)

Arguments

res

Response containing the Division object information.

...

Other response arguments.


Method print()

Print method for Division class.

Usage

Division$print()

Examples

\dontrun{
 division_object <- Division$new(
 	res = x,
		href = x$href,
		auth = auth,
		response = attr(x, "response")
 )
 division_object$print()
}


Method reload()

Reload Division object information.

Usage

Division$reload(...)

Arguments

...

Other arguments that can be passed to core api() function like 'fields', etc.

@importFrom rlang inform

Returns

Division object.

Examples

\dontrun{
 division_object <- Division$new(
   res = x,
   href = x$href,
   auth = auth,
   response = attr(x, "response")
 )
 division_object$reload()
}


Method list_teams()

This call retrieves a list of all teams in a division that you are a member of. Each team's ID and name will be returned.

Usage

Division$list_teams(list_all = FALSE, ...)

Arguments

list_all

Boolean. Set this field to TRUE if you want to list all teams within the division (regardless of whether you are a member of a team or not). Default value is FALSE.

...

Other arguments that can be passed to core api() function like 'fields', etc.

Returns

A Collection of Team objects.

Examples

\dontrun{
  # Get details of a specific division
  division_obj <- a$divisions$get(id = "division-id")

  # Retrieve a list of division teams you are a member of
  division_obj$list_teams()

  # Retrieve a list of all teams within the division regardless of
  # whether you are a member of a team or not
  division_obj$list_teams(list_all = TRUE)
}


Method list_members()

This call retrieves a list of all members of a division. In addition, you can list members with a specific role, e.g. all administrators within a division.

Usage

Division$list_members(
  role = NULL,
  limit = getOption("sevenbridges2")$limit,
  offset = getOption("sevenbridges2")$offset,
  ...
)

Arguments

role

Filter members by role. Supported roles are ADMIN, MEMBER, and EXTERNAL_COLLABORATOR. If NULL (default), members of all roles will be retrieved.

limit

The maximum number of collection items to return for a single request. Minimum value is 1. The maximum value is 100 and the default value is 50. This is a pagination-specific attribute.

offset

The zero-based starting index in the entire collection of the first item to return. The default value is 0. This is a pagination-specific attribute.

...

Other arguments that can be passed to core api() function like other query parameters or 'fields', etc.

Returns

A Collection of User objects.

Examples

\dontrun{
  # Get details of a specific division
  division_obj <- a$divisions$get(id = "division-id")

  # Retrieve a list of all division members
  division_obj$list_members()

  # Or filter members by role. The following roles are supported:
  # "MEMBER", "ADMIN", and "EXTERNAL_COLLABORATOR"
  division_obj$list_members(role = "ADMIN")
}


Method remove_member()

Removes a specified user from a division. This action revokes the user's membership in the division but does not delete their Platform account. Note that only users with the ADMIN role in the division can perform this action.

Usage

Division$remove_member(user)

Arguments

user

The Seven Bridges Platform username of the user to be removed, specified in the format division-name/username, or an object of class User that contains the username.

Examples

\dontrun{
  # Retrieve details of a specific division
  division_obj <- a$divisions$get(id = "division-id")

  # Remove a member using their username
  division_obj$remove_member(user = "division-name/username")

  # Remove a member using a User object
  members <- division_obj$list_members(role = "MEMBER")
  member_to_remove <- members$items[[1]]
  division_obj$remove_member(user = member_to_remove)
}


Method clone()

The objects of this class are cloneable with this method.

Usage

Division$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Division$print`
## ------------------------------------------------

if (FALSE) { # \dontrun{
 division_object <- Division$new(
   res = x,
    href = x$href,
    auth = auth,
    response = attr(x, "response")
 )
 division_object$print()
} # }

## ------------------------------------------------
## Method `Division$reload`
## ------------------------------------------------

if (FALSE) { # \dontrun{
 division_object <- Division$new(
   res = x,
   href = x$href,
   auth = auth,
   response = attr(x, "response")
 )
 division_object$reload()
} # }


## ------------------------------------------------
## Method `Division$list_teams`
## ------------------------------------------------

if (FALSE) { # \dontrun{
  # Get details of a specific division
  division_obj <- a$divisions$get(id = "division-id")

  # Retrieve a list of division teams you are a member of
  division_obj$list_teams()

  # Retrieve a list of all teams within the division regardless of
  # whether you are a member of a team or not
  division_obj$list_teams(list_all = TRUE)
} # }


## ------------------------------------------------
## Method `Division$list_members`
## ------------------------------------------------

if (FALSE) { # \dontrun{
  # Get details of a specific division
  division_obj <- a$divisions$get(id = "division-id")

  # Retrieve a list of all division members
  division_obj$list_members()

  # Or filter members by role. The following roles are supported:
  # "MEMBER", "ADMIN", and "EXTERNAL_COLLABORATOR"
  division_obj$list_members(role = "ADMIN")
} # }


## ------------------------------------------------
## Method `Division$remove_member`
## ------------------------------------------------

if (FALSE) { # \dontrun{
  # Retrieve details of a specific division
  division_obj <- a$divisions$get(id = "division-id")

  # Remove a member using their username
  division_obj$remove_member(user = "division-name/username")

  # Remove a member using a User object
  members <- division_obj$list_members(role = "MEMBER")
  member_to_remove <- members$items[[1]]
  division_obj$remove_member(user = member_to_remove)
} # }