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
connection
IManagementConnectionIManagementConnection used to make all API calls.
baseUri
UriUri of the endpoint to use in making API calls.
defaultHeaders
IDictionary<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
id
stringThe ID of the role to assign permissions to.
request
AssignPermissionsRequestA AssignPermissionsRequest containing the permission identifiers to assign to the role.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to assign users to.
request
AssignUsersRequestA AssignUsersRequest containing the user IDs to assign to the role.
cancellationToken
CancellationTokenThe 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
request
RoleCreateRequestThe RoleCreateRequest containing the details of the role to create.
cancellationToken
CancellationTokenThe cancellation token to cancel operation.
Returns
DeleteAsync(string, CancellationToken)
Deletes a role.
public Task DeleteAsync(string id, CancellationToken cancellationToken = default)
Parameters
id
stringThe ID of the role to delete.
cancellationToken
CancellationTokenThe 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
request
GetRolesRequestSpecifies criteria to use when querying roles.
pagination
PaginationInfoSpecifies pagination info to use when requesting paged results.
cancellationToken
CancellationTokenThe 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
request
GetRolesRequestSpecifies criteria to use when querying roles.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to retrieve.
cancellationToken
CancellationTokenThe 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
id
stringThe id of the role to obtain the permissions for.
pagination
PaginationInfoSpecifies PaginationInfo to use in requesting paged results.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to query.
pagination
CheckpointPaginationInfoSpecifies CheckpointPaginationInfo to use in requesting checkpoint-paginated results.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to query.
pagination
PaginationInfoSpecifies PaginationInfo to use in requesting paged results.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to query.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to remove permissions from.
request
AssignPermissionsRequestA AssignPermissionsRequest containing the permission identifiers to remove from the role.
cancellationToken
CancellationTokenThe 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
id
stringThe ID of the role to update.
request
RoleUpdateRequestA RoleUpdateRequest containing the information to update.
cancellationToken
CancellationTokenThe cancellation token to cancel operation.