Public/Get-HibpPasteAccount.ps1

function Get-HibpPasteAccount {
    <#
        .SYNOPSIS
            Gets all pastes for a specific account.

        .DESCRIPTION
            Retrieves a list of all pastes containing the specified email address.

        .PARAMETER Account
            The email address to search for (e.g., 'test@example.com'). This parameter is required.

        .PARAMETER ApiKey
            Your HIBP API key. Can be used instead of saving the key with Save-HibpCredential.

        .EXAMPLE
            Get-HibpPasteAccount -Account 'test@example.com'

            Returns all pastes for the account 'test@example.com'.

        .LINK
            https://haveibeenpwned.com/API/v3#PastesForAccount
    #>


    [CmdletBinding()]
    Param(
        [Parameter(Mandatory = $true, Position = 0, HelpMessage = 'The email address to search for.', ValueFromPipeline)]
        [string]$Account,

        [string]$ApiKey
    )

    process {
        $endpoint = 'pasteaccount/{0}' -f ([System.Web.HttpUtility]::UrlEncode($Account))

        $invokeParams = @{
            Endpoint = $endpoint
        }

        if ($PSBoundParameters.ContainsKey('ApiKey')) {
            $invokeParams.ApiKey = $ApiKey
        }

        Invoke-HibpRequest @invokeParams
    }
}