Interface IToolService
Manages Roster tools.
Namespace: Microsoft.GNS.Roster.Service
Assembly: Microsoft.GNS.Roster.Service.dll
Syntax
public interface IToolService
Methods
View SourceCreateToolAsync(string, string, Scope, IEnumerable<IRosterPrincipal>)
Creates a Roster tool.
Declaration
Task<IRosterTool> CreateToolAsync(string name, string description, Scope scope, IEnumerable<IRosterPrincipal> admins)
Parameters
Type | Name | Description |
---|---|---|
string | name | The tool name. |
string | description | The tool description. |
Scope | scope | The Roster scope. |
IEnumerable<IRosterPrincipal> | admins | An enumerable list of users who will be admins of the tool. |
Returns
Type | Description |
---|---|
Task<IRosterTool> | An object representing the Roster tool. |
DeleteToolAsync(IRosterTool)
Deletes a Roster tool.
Declaration
Task DeleteToolAsync(IRosterTool tool)
Parameters
Type | Name | Description |
---|---|---|
IRosterTool | tool | The tool to delete. |
Returns
Type | Description |
---|---|
Task | A task representing the work to delete the tool. |
GetAllToolsAsync(Scope)
Gets all tools the current user has access to for a given scope.
Declaration
IAsyncEnumerable<IRosterTool> GetAllToolsAsync(Scope scope)
Parameters
Type | Name | Description |
---|---|---|
Scope | scope | The tool scope. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IRosterTool> | An enumeration of all tools the given principal has access to. |
GetToolByIdAsync(Guid, AccessLevel, bool)
Gets a tool by Id.
Declaration
Task<IRosterTool> GetToolByIdAsync(Guid id, AccessLevel accessLevel = AccessLevel.Admin, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The Id of the tool. |
AccessLevel | accessLevel | The level of access for the current user in which to check for. |
bool | throwIfNotFound | If true throws an EntityNotFoundException if the tool does not exist. If false will return Microsoft.GNS.Roster.Internal.RosterTool.Empty. |
Returns
Type | Description |
---|---|
Task<IRosterTool> | An object that represents a tool in Roster. |
GetToolByNameAsync(string, Scope, AccessLevel, bool)
Gets a tool by name.
Declaration
Task<IRosterTool> GetToolByNameAsync(string name, Scope scope, AccessLevel accessLevel = AccessLevel.Admin, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the tool. |
Scope | scope | The tool 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 tool does not exist. If false will return Microsoft.GNS.Roster.Internal.RosterTool.Empty. |
Returns
Type | Description |
---|---|
Task<IRosterTool> | An object that represents an tool in Roster. |
IsCurrentUserToolAdminAsync(IRosterTool)
Checks if a principal is a tool admin.
Declaration
Task<bool> IsCurrentUserToolAdminAsync(IRosterTool tool)
Parameters
Type | Name | Description |
---|---|---|
IRosterTool | tool | The tool to check. |
Returns
Type | Description |
---|---|
Task<bool> |
SearchToolsByNameAsync(string, Scope, bool, int)
Searches tools by name.
Declaration
IAsyncEnumerable<IRosterTool> SearchToolsByNameAsync(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<IRosterTool> | An enumerable list of Roster tools. |
SetToolAdminsAsync(IRosterTool, IEnumerable<IRosterPrincipal>?, IEnumerable<IRosterPrincipal>?)
Sets admins for a tool.
Declaration
Task SetToolAdminsAsync(IRosterTool tool, IEnumerable<IRosterPrincipal>? adminsToAdd = null, IEnumerable<IRosterPrincipal>? adminsToRemove = null)
Parameters
Type | Name | Description |
---|---|---|
IRosterTool | tool | The tool 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 tool admins. |
UpdateToolAsync(IRosterTool)
Updates a tool.
Declaration
Task<IRosterTool> UpdateToolAsync(IRosterTool tool)
Parameters
Type | Name | Description |
---|---|---|
IRosterTool | tool | The tool to update. |
Returns
Type | Description |
---|---|
Task<IRosterTool> | The updated tool object. |