public/helper/Send-TwitterStatuses_Unretweet_Id.ps1

function Send-TwitterStatuses_Unretweet_Id {
<#
.SYNOPSIS
    Post, retrieve and engage with Tweets

.DESCRIPTION
    POST statuses/unretweet/:id
    
    Untweets a retweeted status. Returns the original Tweet with Retweet details embedded.
    
    Usage Notes:
    
    This method is subject to update limits. A HTTP 429 will be returned if this limit has been hit.
    The untweeted retweet status ID must be authored by the user backing the authentication token.
    An application must have write privileges to POST. A HTTP 401 will be returned for read-only applications.
    When passing a source status ID instead of the retweet status ID a HTTP 200 response will be returned with the same Tweet object but no action.

.PARAMETER id
    The numerical ID of the desired status.

.PARAMETER trim_user
    When set to either true , t or 1 , each Tweet returned in a timeline will include a user object including only the status authors numerical ID. Omit this parameter to receive the complete user object.

.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-unretweet-id

#>

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

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

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

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

    }
    End {

    }
}