Interface IProjectService
Manages Roster projects.
Namespace: Microsoft.GNS.Roster.Service
Assembly: Microsoft.GNS.Roster.Service.dll
Syntax
public interface IProjectService
Methods
View SourceCreateProjectAsync(string, string, Scope, IEnumerable<IRosterPrincipal>, IEnumerable<IRosterPrincipal>?)
Creates a Roster project.
Declaration
Task<IRosterProject> CreateProjectAsync(string name, string description, Scope scope, IEnumerable<IRosterPrincipal> projectAdmins, IEnumerable<IRosterPrincipal>? projectMembers = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The project name. |
string | description | The project description. |
Scope | scope | The Roster scope. |
IEnumerable<IRosterPrincipal> | projectAdmins | The project admin(s). |
IEnumerable<IRosterPrincipal> | projectMembers | The project members(s). |
Returns
Type | Description |
---|---|
Task<IRosterProject> | An object representing the Roster project. |
DeleteProjectAsync(IRosterProject)
Deletes a Roster project.
Declaration
Task DeleteProjectAsync(IRosterProject project)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project | The project to delete. |
Returns
Type | Description |
---|---|
Task | A task representing the work to delete the project. |
GetAllProjectsAsync(Scope)
Gets all projects the current user has access to for a given scope.
Declaration
IAsyncEnumerable<IRosterProject> GetAllProjectsAsync(Scope scope)
Parameters
Type | Name | Description |
---|---|---|
Scope | scope | The project scope. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterProject> | An enumeration of all projects the given principal has access to. |
GetAllProjectsWithRoleAsync(Scope, string)
Gets all projects that contain a role and the current user has access to for a given scope.
Declaration
IAsyncEnumerable<IRosterProject> GetAllProjectsWithRoleAsync(Scope scope, string roleName)
Parameters
Type | Name | Description |
---|---|---|
Scope | scope | The project scope. |
string | roleName | The role name the project must contain. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterProject> | An enumeration of all projects the given principal has access to and that contain the role. |
GetProjectByIdAsync(Guid, AccessLevel, bool)
Gets a project by Id.
Declaration
Task<IRosterProject> GetProjectByIdAsync(Guid id, AccessLevel accessLevel = AccessLevel.Admin, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The Id of the project. |
AccessLevel | accessLevel | The level of access for the current user in which to check for. |
bool | throwIfNotFound | If true throws an EntityNotFoundException if the project does not exist. If false will return Microsoft.GNS.Roster.Internal.RosterProject.Empty. |
Returns
Type | Description |
---|---|
Task<IRosterProject> | An object that represents an project in Roster. |
GetProjectByNameAsync(string, Scope, AccessLevel, bool)
Gets a project by name.
Declaration
Task<IRosterProject> GetProjectByNameAsync(string name, Scope scope, AccessLevel accessLevel = AccessLevel.Admin, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the project. |
Scope | scope | The project scope. |
AccessLevel | accessLevel | The level of access for the current user in which to check for. |
bool | throwIfNotFound | If true throws an EntityNotFoundException if the project does not exist. If false will return Microsoft.GNS.Roster.Internal.RosterProject.Empty. |
Returns
Type | Description |
---|---|
Task<IRosterProject> | An object that represents an project in Roster. |
IsCurrentUserProjectAdminAsync(IRosterProject)
Checks if a principal is a project admin.
Declaration
Task<bool> IsCurrentUserProjectAdminAsync(IRosterProject project)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project |
Returns
Type | Description |
---|---|
Task<bool> |
SearchProjectsByNameAsync(string, Scope, bool, int)
Searches projects by name.
Declaration
IAsyncEnumerable<IRosterProject> SearchProjectsByNameAsync(string name, Scope scope, bool caseSensitive = false, int take = 0)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name to search for. |
Scope | scope | The Roster scope. |
bool | caseSensitive | True for a case sensitive search. Otherwise, false. |
int | take | The number of items to take. Default of 0 returns all results. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterProject> | An enumerable list of Roster projects. |
SetProjectAdminsAsync(IRosterProject, IEnumerable<IRosterPrincipal>?, IEnumerable<IRosterPrincipal>?)
Sets admins in a project.
Declaration
Task SetProjectAdminsAsync(IRosterProject project, IEnumerable<IRosterPrincipal>? adminsToAdd = null, IEnumerable<IRosterPrincipal>? adminsToRemove = null)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project | The project in which to modify admins. |
IEnumerable<IRosterPrincipal> | adminsToAdd | An optional enumerable list of admins to add. |
IEnumerable<IRosterPrincipal> | adminsToRemove | An optional enumerable list of admins to remove. |
Returns
Type | Description |
---|---|
Task | A task representing the work to set project admins. |
SetProjectMembersAsync(IRosterProject, IEnumerable<IRosterPrincipal>?, IEnumerable<IRosterPrincipal>?)
Sets members in a project.
Declaration
Task SetProjectMembersAsync(IRosterProject project, IEnumerable<IRosterPrincipal>? membersToAdd = null, IEnumerable<IRosterPrincipal>? membersToRemove = null)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project | The project in which to modify members. |
IEnumerable<IRosterPrincipal> | membersToAdd | An optional enumerable list of members to add. |
IEnumerable<IRosterPrincipal> | membersToRemove | An optional enumerable list of members to remove. |
Returns
Type | Description |
---|---|
Task | A task representing the work to set project members. |
SetProjectRolesAsync(IRosterProject, IEnumerable<IRosterRole>?, IEnumerable<IRosterRole>?)
Sets roles in a project.
Declaration
Task SetProjectRolesAsync(IRosterProject project, IEnumerable<IRosterRole>? rolesToAdd = null, IEnumerable<IRosterRole>? rolesToRemove = null)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project | The project in which to modify roles. |
IEnumerable<IRosterRole> | rolesToAdd | An optional enumerable list of roles to add. |
IEnumerable<IRosterRole> | rolesToRemove | An optional enumerable list of roles to remove. |
Returns
Type | Description |
---|---|
Task | A task representing the work to set project roles. |
SetProjectToolsAsync(IRosterProject, IEnumerable<IRosterTool>?, IEnumerable<IRosterTool>?)
Sets tools in a project.
Declaration
Task SetProjectToolsAsync(IRosterProject project, IEnumerable<IRosterTool>? toolsToAdd = null, IEnumerable<IRosterTool>? toolsToRemove = null)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project | The project in which to modify tools. |
IEnumerable<IRosterTool> | toolsToAdd | An optional enumerable list of tools to add. |
IEnumerable<IRosterTool> | toolsToRemove | An optional enumerable list of tools to remove. |
Returns
Type | Description |
---|---|
Task | A task representing the work to set project tools. |
UpdateProjectAsync(IRosterProject)
Updates a project.
Declaration
Task<IRosterProject> UpdateProjectAsync(IRosterProject project)
Parameters
Type | Name | Description |
---|---|---|
IRosterProject | project | The project to update. |
Returns
Type | Description |
---|---|
Task<IRosterProject> | The updated project object. |