Public/Get-HibpSubscribedDomain.ps1

function Get-HibpSubscribedDomain {
    <#
        .SYNOPSIS
            Gets all domains the user is subscribed to for domain searches.

        .DESCRIPTION
            Retrieves a list of all domains that have been subscribed to for the API key provided.
            This is a premium feature and requires a subscription.

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

        .EXAMPLE
            Get-HibpSubscribedDomain

            Returns all domains subscribed to by the current API key.

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


    [CmdletBinding()]
    Param(
        [string]$ApiKey
    )

    $invokeParams = @{
        Endpoint = 'subscribeddomains'
    }

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

    Invoke-HibpRequest @invokeParams
}