public/helper/Send-TwitterFavorites_Destroy.ps1

function Send-TwitterFavorites_Destroy {
<#
.SYNOPSIS
    Post, retrieve and engage with Tweets
 
.DESCRIPTION
    POST favorites/destroy
     
    Note: favorites are now known as likes.
     
    Unfavorites (un-likes) the Tweet specified in the ID parameter as the authenticating user. Returns the un-liked Tweet when successful.
     
    The process invoked by this method is asynchronous. The immediately returned Tweet object may not indicate the resultant favorited status of the Tweet. A 200 OK response from this method will indicate whether the intended action was successful or not.
 
.PARAMETER id
    The numerical ID of the Tweet to un-like
 
.PARAMETER include_entities
    The entities node will be omitted when set to false .
 
.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy
 
#>

    [CmdletBinding()]
    Param(
        [string]$id,
        [string]$include_entities
    )
    Begin {

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

        [string]$Method      = 'POST'
        [string]$Resource    = '/favorites/destroy'
        [string]$ResourceUrl = 'https://api.twitter.com/1.1/favorites/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 {

    }
}