public/helper/Send-TwitterOauth_InvalidateToken.ps1

function Send-TwitterOauth_InvalidateToken {
<#
.SYNOPSIS
    Authentication
 
.DESCRIPTION
    POST oauth/invalidate_token
     
    Allows a registered application to revoke an issued OAuth access_token by presenting its client credentials. Once an access_token has been invalidated, new creation attempts will yield a different Access Token and usage of the invalidated token will no longer be allowed.
 
.PARAMETER access_token
    The access_token of user to be invalidated
 
.PARAMETER access_token_secret
    The access_token_secret of user to be invalidated
 
.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_access_token
 
#>

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

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

        [string]$Method      = 'POST'
        [string]$Resource    = '/oauth/invalidate_token'
        [string]$ResourceUrl = 'https://api.twitter.com/oauth/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
        }

        If (-Not $OAuthSettings) { $OAuthSettings = Get-TwitterOAuthSettings -Resource $Resource }
        Invoke-TwitterAPI -Method $Method -ResourceUrl $ResourceUrl -Parameters $Parameters -OAuthSettings $OAuthSettings

    }
    End {

    }
}