Class RolesClient
- Namespace
- Auth0.ManagementApi.Clients
- Assembly
- Auth0.ManagementApi.dll
Contains methods to access the /roles endpoints.
public class RolesClient : BaseClient, IRolesClient- Inheritance
- 
      
      
      RolesClient
- Implements
- Inherited Members
Constructors
RolesClient(IManagementConnection, Uri, IDictionary<string, string>)
Initializes a new instance of the RolesClient class.
public RolesClient(IManagementConnection connection, Uri baseUri, IDictionary<string, string> defaultHeaders)Parameters
- connectionIManagementConnection
- IManagementConnection used to make all API calls. 
- baseUriUri
- Uri of the endpoint to use in making API calls. 
- defaultHeadersIDictionary<string, string>
- Dictionary containing default headers included with every request this client makes. 
Methods
AssignPermissionsAsync(string, AssignPermissionsRequest, CancellationToken)
Assign permissions to a role.
public Task AssignPermissionsAsync(string id, AssignPermissionsRequest request, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to assign permissions to. 
- requestAssignPermissionsRequest
- A AssignPermissionsRequest containing the permission identifiers to assign to the role. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
AssignUsersAsync(string, AssignUsersRequest, CancellationToken)
Assigns Users to a role.
public Task AssignUsersAsync(string id, AssignUsersRequest request, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to assign users to. 
- requestAssignUsersRequest
- A AssignUsersRequest containing the user IDs to assign to the role. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
CreateAsync(RoleCreateRequest, CancellationToken)
Creates a new role according to the request.
public Task<Role> CreateAsync(RoleCreateRequest request, CancellationToken cancellationToken = default)Parameters
- requestRoleCreateRequest
- The RoleCreateRequest containing the details of the role to create. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
DeleteAsync(string, CancellationToken)
Deletes a role.
public Task DeleteAsync(string id, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to delete. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
GetAllAsync(GetRolesRequest, PaginationInfo, CancellationToken)
Retrieves a list of all roles.
public Task<IPagedList<Role>> GetAllAsync(GetRolesRequest request, PaginationInfo pagination, CancellationToken cancellationToken = default)Parameters
- requestGetRolesRequest
- Specifies criteria to use when querying roles. 
- paginationPaginationInfo
- Specifies pagination info to use when requesting paged results. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
- Task<IPagedList<Role>>
- An IPagedList<T> containing the roles requested. 
GetAllAsync(GetRolesRequest, CancellationToken)
Retrieves a list of all roles.
public Task<IPagedList<Role>> GetAllAsync(GetRolesRequest request, CancellationToken cancellationToken = default)Parameters
- requestGetRolesRequest
- Specifies criteria to use when querying roles. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
- Task<IPagedList<Role>>
- An IPagedList<T> containing the roles 
GetAsync(string, CancellationToken)
Retrieves a role by its ID.
public Task<Role> GetAsync(string id, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to retrieve. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
GetPermissionsAsync(string, PaginationInfo, CancellationToken)
Gets the permissions assigned to a role.
public Task<IPagedList<Permission>> GetPermissionsAsync(string id, PaginationInfo pagination, CancellationToken cancellationToken = default)Parameters
- idstring
- The id of the role to obtain the permissions for. 
- paginationPaginationInfo
- Specifies PaginationInfo to use in requesting paged results. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
- Task<IPagedList<Permission>>
- An IPagedList<T> containing the assigned permissions for this role. 
GetUsersAsync(string, CheckpointPaginationInfo, CancellationToken)
Retrieves a list of users associated with a role.
public Task<ICheckpointPagedList<AssignedUser>> GetUsersAsync(string id, CheckpointPaginationInfo pagination, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to query. 
- paginationCheckpointPaginationInfo
- Specifies CheckpointPaginationInfo to use in requesting checkpoint-paginated results. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
- Task<ICheckpointPagedList<AssignedUser>>
- An IPagedList<T> containing the assigned users. 
GetUsersAsync(string, PaginationInfo, CancellationToken)
Retrieves a list of users associated with a role.
public Task<IPagedList<AssignedUser>> GetUsersAsync(string id, PaginationInfo pagination, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to query. 
- paginationPaginationInfo
- Specifies PaginationInfo to use in requesting paged results. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
- Task<IPagedList<AssignedUser>>
- An IPagedList<T> containing the assigned users. 
GetUsersAsync(string, CancellationToken)
Retrieves a list of users associated with a role.
public Task<IPagedList<AssignedUser>> GetUsersAsync(string id, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to query. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
- Task<IPagedList<AssignedUser>>
- An IPagedList<T> containing the assigned users. 
RemovePermissionsAsync(string, AssignPermissionsRequest, CancellationToken)
Remove permissions assigned to a role.
public Task RemovePermissionsAsync(string id, AssignPermissionsRequest request, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to remove permissions from. 
- requestAssignPermissionsRequest
- A AssignPermissionsRequest containing the permission identifiers to remove from the role. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation. 
Returns
UpdateAsync(string, RoleUpdateRequest, CancellationToken)
Updates a role.
public Task<Role> UpdateAsync(string id, RoleUpdateRequest request, CancellationToken cancellationToken = default)Parameters
- idstring
- The ID of the role to update. 
- requestRoleUpdateRequest
- A RoleUpdateRequest containing the information to update. 
- cancellationTokenCancellationToken
- The cancellation token to cancel operation.