public/helper/Send-TwitterOauth2_InvalidateToken.ps1

function Send-TwitterOauth2_InvalidateToken {
<#
.SYNOPSIS
    Authentication

.DESCRIPTION
    POST oauth2/invalidate_token
    
    Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials. Once a Bearer Token has been invalidated, new creation attempts will yield a different Bearer Token and usage of the invalidated token will no longer be allowed.
    
    Successful responses include a JSON-structure describing the revoked Bearer Token.

.PARAMETER access_token
    The value of the bearer token to revoke.

.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_bearer_token

#>

    [CmdletBinding()]
    Param(
        [string]$access_token
    )
    Begin {

        [hashtable]$Parameters = $PSBoundParameters
                   $CmdletBindingParameters | ForEach-Object { $Parameters.Remove($_) }

        [string]$Method      = 'POST'
        [string]$Resource    = '/oauth2/invalidate_token'
        [string]$ResourceUrl = 'https://api.twitter.com/oauth2/invalidate_token'

    }
    Process {

        # Find & Replace any ResourceUrl parameters.
        $UrlParameters = [regex]::Matches($ResourceUrl, '(?<!\w):\w+')
        ForEach ($UrlParameter in $UrlParameters) {
            $UrlParameterValue = $Parameters["$($UrlParameter.Value.TrimStart(":"))"]
            $ResourceUrl = $ResourceUrl -Replace $UrlParameter.Value, $UrlParameterValue
        }

        $OAuthSettings = Get-TwitterOAuthSettings -Resource $Resource
        Invoke-TwitterAPI -Method $Method -ResourceUrl $ResourceUrl -Parameters $Parameters -OAuthSettings $OAuthSettings

    }
    End {

    }
}