updateOrganizationRole method

Future<Role?> updateOrganizationRole(
  1. String organizationRoleId,
  2. UpdateOrganizationRoleRequest updateOrganizationRoleRequest
)

Update an organization role

Updates an existing organization role. You can update the name, key, description, and permissions of the role. All parameters are optional - you can update only the fields you want to change. If the role is used as a creator role or domain default role, updating the key will cascade the update to the organization settings.

Parameters:

Implementation

Future<Role?> updateOrganizationRole(
  String organizationRoleId,
  UpdateOrganizationRoleRequest updateOrganizationRoleRequest,
) async {
  final response = await updateOrganizationRoleWithHttpInfo(
    organizationRoleId,
    updateOrganizationRoleRequest,
  );
  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),
      'Role',
    ) as Role;
  }
  return null;
}