public class BoxGroup extends BoxCollaborator
Unless otherwise noted, the methods in this class can throw an unchecked BoxAPIException
(unchecked
meaning that the compiler won't force you to handle it) if an error occurs. If you wish to implement custom error
handling for errors related to the Box REST API, you should capture this exception explicitly.
Modifier and Type | Class and Description |
---|---|
class |
BoxGroup.Info
Contains information about a BoxGroup.
|
Constructor and Description |
---|
BoxGroup(BoxAPIConnection api,
String id)
Constructs a BoxGroup for a group with a given ID.
|
Modifier and Type | Method and Description |
---|---|
BoxGroupMembership.Info |
addMembership(BoxUser user)
Adds a member to this group with the default role.
|
BoxGroupMembership.Info |
addMembership(BoxUser user,
BoxGroupMembership.Role role)
Adds a member to this group with the specified role.
|
static BoxGroup.Info |
createGroup(BoxAPIConnection api,
String name)
Creates a new group with a specified name.
|
void |
delete()
Deletes this group.
|
static Iterable<BoxGroup.Info> |
getAllGroups(BoxAPIConnection api)
Gets an iterable of all the groups that the current user is a member of.
|
BoxGroup.Info |
getInfo()
Gets information about this group.
|
Collection<BoxGroupMembership.Info> |
getMemberships()
Gets information about all of the group memberships for this group.
|
equals, getAPI, getID, hashCode
public BoxGroup(BoxAPIConnection api, String id)
api
- the API connection to be used by the group.id
- the ID of the group.public static BoxGroup.Info createGroup(BoxAPIConnection api, String name)
api
- the API connection to be used by the group.name
- the name of the new group.public static Iterable<BoxGroup.Info> getAllGroups(BoxAPIConnection api)
api
- the API connection to be used when retrieving the groups.public BoxGroup.Info getInfo()
public Collection<BoxGroupMembership.Info> getMemberships()
public BoxGroupMembership.Info addMembership(BoxUser user)
user
- the member to be added to this group.public BoxGroupMembership.Info addMembership(BoxUser user, BoxGroupMembership.Role role)
user
- the member to be added to this group.role
- the role of the user in this group. Can be null to assign the default role.public void delete()