Interface IGroupService
Represents the group API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IGroupService
  Examples
_groupService = relativityFacade.Resolve<IGroupService>();
  Methods
| Improve this Doc View SourceCreate(Group)
Creates the specified Group.
Declaration
Group Create(Group entity)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Group | entity | The Group entity to create.  | 
      
Returns
| Type | Description | 
|---|---|
| Group | The created Group entity.  | 
      
Examples
var client = relativityFacade.Resolve<IClientService>().Get(clientArtifactId);
var entity = new Group
{
	Name = Randomizer.GetString("AT_"),
	Client = client
};
var group = _groupService.Create(entity);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Delete(Int32)
Deletes the group by ID.
Declaration
void Delete(int id)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | The artifact ID of the group.  | 
      
Examples
_groupService.Delete(someExistingGroupId);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Get(Int32, Boolean, Boolean)
Gets the group by the specified ID.
Declaration
Group Get(int id, bool includeMetadata = false, bool includeActions = false)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | id | The artifact ID of the group.  | 
      
| System.Boolean | includeMetadata | Indicates wheter to include group Meta property. Default is false.  | 
      
| System.Boolean | includeActions | Indicates wheter to include group Actions property. Default is false.  | 
      
Returns
| Type | Description | 
|---|---|
| Group | The Group entity or null.  | 
      
Examples
var entity = _groupService.Get(groupArtifactId);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Get(String)
Gets the group by the specified group name.
Declaration
Group Get(string name)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | The name of the group.  | 
      
Returns
| Type | Description | 
|---|---|
| Group | The Group entity or null.  | 
      
Examples
var name = "Some Existing Group Name";
var entity = _groupService.Get(name);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  GetAll(IEnumerable<String>)
Gets all groups by the specified names.
Declaration
IEnumerable<Group> GetAll(IEnumerable<string> names)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.IEnumerable<System.String> | names | The collection of group names.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<Group> | The collection of Group entities.  | 
      
Examples
var names = new List<string>{"Some Existing Group Name", "Other Existing Group Name"};
var entity = _groupService.GetAll(names);
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Require(Group)
Requires the specified group.
- If [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of 
entityhas positive value, gets entity by ID and updates it. - If [Name](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.NamedArtifact.html#Relativity_Testing_Framework_Models_NamedArtifact_Name) property of 
entityhave a value, gets entity by name and updates it if it exists. - Otherwise creates a new entity using Relativity.Testing.Framework.Api.Strategies.ICreateWorkspaceEntityStrategy`1.
 
Declaration
Group Require(Group entity)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Group | entity | The entity to require.  | 
      
Returns
| Type | Description | 
|---|---|
| Group | The entity required.  | 
      
Examples
var name = "Some Existing Group Name";
var entity = _groupService.Get(name);
entity.Keywords = "Test";
var group = _groupService.Require(entity); //Will get group by name, update it and return
  var groupId = 1;
var entity = _groupService.Get(groupId);
entity.Keywords = "Test";
var group = _groupService.Require(entity); //Will get group by Artifact ID, update it and return
  var client = relativityFacade.Resolve<IClientService>().Get(clientArtifactId);
var entity = new Group
{
	Name = Randomizer.GetString("AT_"),
	Client = client
};
var group = _groupService.Require(entity); //Will create new group
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Update(Group)
Updates the specified group.
Declaration
Group Update(Group entity)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Group | entity | The entity to update.  | 
      
Returns
| Type | Description | 
|---|---|
| Group | Updated   | 
      
Examples
var groupId = 1;
var entity = new Group
{
	Name = "Some Existing Group Name",
	Keywords = "Test Edited Keywords"
}
Group updatedGroup = _groupService.Update(entity);