addRolesToRoleSet method

Future<RoleSet?> addRolesToRoleSet(
  1. String roleSetKeyOrId,
  2. AddRolesToRoleSetRequest addRolesToRoleSetRequest
)

Add roles to a role set

Adds one or more roles to an existing role set. You can optionally update the default role or creator role when adding new roles.

Parameters:

Implementation

Future<RoleSet?> addRolesToRoleSet(
  String roleSetKeyOrId,
  AddRolesToRoleSetRequest addRolesToRoleSetRequest,
) async {
  final response = await addRolesToRoleSetWithHttpInfo(
    roleSetKeyOrId,
    addRolesToRoleSetRequest,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty &&
      response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'RoleSet',
    ) as RoleSet;
  }
  return null;
}