def create_user(
    client: httpx.Client,
    first_name: str,
    username: str,
    password: str,
    last_name: Optional[str] = None,
    role: UserRole = UserRole.annotator,
    workspaces: Optional[List[str]] = None,
) -> Response[Union[UserModel, ErrorMessage, HTTPValidationError]]:
    """Sends a POST request to `/api/users` endpoint to create a new user.

    Args:
        client: the authenticated Argilla client to be used to send the request to the API.
        first_name: the first name of the user. Must be a string of at least 1 character.
        last_name: the last name of the user. Is optional and defaults to `None`, but if provided
            must be a string of at least 1 character.
        username: the username of the user. Must be a string matching the following regex:
            ^(?!-|_)[a-z0-9-_]+$.
        role: the role of the user. Available roles are: `admin`, and `annotator`.
        password: the password of the user. Must be a string between 8 and 100 characters.
        workspaces: a list of workspace names to which the user will be linked to.

    Returns:
        A `Response` object containing a `parsed` attribute with the parsed response if
        the request was successful, which is an instance of `UserModel`.
    """
    url = "/api/users"

    user = UserCreateModel(
        first_name=first_name,
        last_name=last_name,
        username=username,
        role=role,
        password=password,
        workspaces=workspaces,
    )

    response = client.post(
        url=url,
        json=user.dict(exclude_none=True),
    )

    if response.status_code == 200:
        parsed_response = UserModel(**response.json())
        return Response(
            status_code=response.status_code,
            content=response.content,
            headers=response.headers,
            parsed=parsed_response,
        )
    return handle_response_error(response)
Sends a POST request to `/api/users` endpoint to create a new user.

    Args:
        client: the authenticated Argilla client to be used to send the request to the API.
        first_name: the first name of the user. Must be a string of at least 1 character.
        last_name: the last name of the user. Is optional and defaults to `None`, but if provided
            must be a string of at least 1 character.
        username: the username of the user. Must be a string matching the following regex:
            ^(?!-|_)[a-z0-9-_]+$.
        role: the role of the user. Available roles are: `admin`, and `annotator`.
        password: the password of the user. Must be a string between 8 and 100 characters.
        workspaces: a list of workspace names to which the user will be linked to.

    Returns:
        A `Response` object containing a `parsed` attribute with the parsed response if
        the request was successful, which is an instance of `UserModel`.
    
argilla-v1/src/argilla_v1/client/sdk/users/api.py