Table of Contents

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 IManagementConnection

IManagementConnection used to make all API calls.

baseUri Uri

Uri 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 string

The ID of the role to assign permissions to.

request AssignPermissionsRequest

A AssignPermissionsRequest containing the permission identifiers to assign to the role.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task

A Task that represents the asynchronous assignment operation.

AssignUsersAsync(string, AssignUsersRequest, CancellationToken)

Assigns Users to a role.

public Task AssignUsersAsync(string id, AssignUsersRequest request, CancellationToken cancellationToken = default)

Parameters

id string

The ID of the role to assign users to.

request AssignUsersRequest

A AssignUsersRequest containing the user IDs to assign to the role.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task

A Task that represents the asynchronous assign operation.

CreateAsync(RoleCreateRequest, CancellationToken)

Creates a new role according to the request.

public Task<Role> CreateAsync(RoleCreateRequest request, CancellationToken cancellationToken = default)

Parameters

request RoleCreateRequest

The RoleCreateRequest containing the details of the role to create.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task<Role>

The newly created Role.

DeleteAsync(string, CancellationToken)

Deletes a role.

public Task DeleteAsync(string id, CancellationToken cancellationToken = default)

Parameters

id string

The ID of the role to delete.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task

A Task that represents the asynchronous delete operation.

GetAllAsync(GetRolesRequest, PaginationInfo, CancellationToken)

Retrieves a list of all roles.

public Task<IPagedList<Role>> GetAllAsync(GetRolesRequest request, PaginationInfo pagination, CancellationToken cancellationToken = default)

Parameters

request GetRolesRequest

Specifies criteria to use when querying roles.

pagination PaginationInfo

Specifies pagination info to use when requesting paged results.

cancellationToken CancellationToken

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

request GetRolesRequest

Specifies criteria to use when querying roles.

cancellationToken CancellationToken

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

id string

The ID of the role to retrieve.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task<Role>

The Role that was requested.

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 string

The id of the role to obtain the permissions for.

pagination PaginationInfo

Specifies PaginationInfo to use in requesting paged results.

cancellationToken CancellationToken

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

id string

The ID of the role to query.

pagination CheckpointPaginationInfo

Specifies CheckpointPaginationInfo to use in requesting checkpoint-paginated results.

cancellationToken CancellationToken

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

id string

The ID of the role to query.

pagination PaginationInfo

Specifies PaginationInfo to use in requesting paged results.

cancellationToken CancellationToken

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

id string

The ID of the role to query.

cancellationToken CancellationToken

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

id string

The ID of the role to remove permissions from.

request AssignPermissionsRequest

A AssignPermissionsRequest containing the permission identifiers to remove from the role.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task

A Task that represents the asynchronous remove operation.

UpdateAsync(string, RoleUpdateRequest, CancellationToken)

Updates a role.

public Task<Role> UpdateAsync(string id, RoleUpdateRequest request, CancellationToken cancellationToken = default)

Parameters

id string

The ID of the role to update.

request RoleUpdateRequest

A RoleUpdateRequest containing the information to update.

cancellationToken CancellationToken

The cancellation token to cancel operation.

Returns

Task<Role>

The newly updated Role.