Public/Remove-GhostMember.ps1

function Remove-GhostMember {
    <#
    .SYNOPSIS
        Deletes a member from the Ghost site.

    .DESCRIPTION
        Deletes the member, which cannot be undone: the member can no longer sign in and gets no more
        newsletters. A deleted member can sign up again as a new one.

        The documentation of Ghost does not list this endpoint. Ghost Admin uses it, and Ghost 6 accepts it from
        an integration.

        This function does not ask Ghost to cancel a subscription that the member pays for in Stripe. Cancel it
        in Ghost Admin or in Stripe first.

    .EXAMPLE
        Remove-GhostMember -Id '6b01427efe775327e09cd36d'

        Deletes the member, after confirmation.

    .EXAMPLE
        Get-GhostMember -Filter "email:'jamie@example.com'" | Remove-GhostMember -Confirm:$false

        Deletes the member with that email address without asking.

    .EXAMPLE
        Get-GhostMember -Filter 'label:test' | Remove-GhostMember -WhatIf

        Shows which members with the label test would be deleted.

    .LINK
        https://docs.ghost.org/admin-api/members/overview
    #>

    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
    [OutputType([void])]
    param(
        # Id of the member to delete.
        [Parameter(Mandatory, Position = 0, ValueFromPipelineByPropertyName)]
        [ValidateNotNullOrEmpty()]
        [string] $Id
    )

    begin {
        Test-GhostConnection
        $resources = Get-GhostAPIData -Endpoint $MyInvocation.MyCommand.Name
    }

    process {
        try {
            $uri = New-URIString -Endpoint $resources.URI -Parameters $PSBoundParameters

            if ($PSCmdlet.ShouldProcess($Id, $resources.Description)) {
                $null = Submit-Request -Uri $uri -Method $resources.Method -Success $resources.Success
            }
        }
        catch {
            $PSCmdlet.ThrowTerminatingError($_)
        }
    }
}