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 |
---|---|---|
System.String | name | The tool name. |
System.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, Boolean)
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. |
System.Boolean | throwIfNotFound | If true throws an EntityNotFoundException if the tool does not exist. If false will return |
Returns
Type | Description |
---|---|
Task<IRosterTool> | An object that represents a tool in Roster. |
GetToolByNameAsync(String, Scope, AccessLevel, Boolean)
Gets a tool by name.
Declaration
Task<IRosterTool> GetToolByNameAsync(string name, Scope scope, AccessLevel accessLevel = AccessLevel.Admin, bool throwIfNotFound = false)
Parameters
Type | Name | Description |
---|---|---|
System.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. |
System.Boolean | throwIfNotFound | If true throws an EntityNotFoundException if the tool does not exist. If false will return |
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<System.Boolean> |
SearchToolsByNameAsync(String, Scope, Boolean, Int32)
Searches tools by name.
Declaration
IAsyncEnumerable<IRosterTool> SearchToolsByNameAsync(string name, Scope scope, bool caseSensitive = false, int take = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name to search for. |
Scope | scope | The Roster scope. |
System.Boolean | caseSensitive | True for a case sensitive search. Otherwise, false. |
System.Int32 | 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, Nullable<IEnumerable<IRosterPrincipal>>, Nullable<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. |
System.Nullable<IEnumerable<IRosterPrincipal>> | adminsToAdd | An optional enumerable list of admins to add. |
System.Nullable<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. |