public/helper/Send-TwitterLists_Destroy.ps1

function Send-TwitterLists_Destroy {
<#
.SYNOPSIS
    Create and manage lists
 
.DESCRIPTION
    POST lists/destroy
     
    Deletes the specified list. The authenticated user must own the list to be able to destroy it.
 
.PARAMETER owner_screen_name
    The screen name of the user who owns the list being requested by a slug .
 
.PARAMETER owner_id
    The user ID of the user who owns the list being requested by a slug .
 
.PARAMETER list_id
    The numerical id of the list.
 
.PARAMETER slug
    You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.
 
.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy
 
#>

    [CmdletBinding()]
    Param(
        [string]$owner_screen_name,
        [string]$owner_id,
        [string]$list_id,
        [string]$slug
    )
    Begin {

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

        [string]$Method      = 'POST'
        [string]$Resource    = '/lists/destroy'
        [string]$ResourceUrl = 'https://api.twitter.com/1.1/lists/destroy.json'

    }
    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 {

    }
}