Public/Connect/Disconnect-KB4Reporting.ps1

<#
.SYNOPSIS
Clears the current KnowBe4 Reporting API connection.

.DESCRIPTION
Removes the in-memory PSKB4Reporting connection context and request pacing state. This
does not revoke or modify the API token in KnowBe4.

.EXAMPLE
Disconnect-KB4Reporting

Disconnects the current PSKB4Reporting session.

.EXAMPLE
Disconnect-KB4Reporting -WhatIf

Shows what would be disconnected without clearing the context.

.OUTPUTS
None.
#>

function Disconnect-KB4Reporting
{
    [CmdletBinding(SupportsShouldProcess)]
    param()

    if ($PSCmdlet.ShouldProcess('KnowBe4 Reporting API context', 'Disconnect'))
    {
        $script:KB4ReportingContext = $null
        $script:KB4LastRequestAt = $null
    }
}