public/helper/Send-TwitterCollections_EntriesAdd.ps1

function Send-TwitterCollections_EntriesAdd {
<#
.SYNOPSIS
    Curate a collection of Tweets
 
.DESCRIPTION
    POST collections/entries/add
     
    Add a specified Tweet to a Collection.
     
    A collection will store up to a few thousand Tweets. Adding a Tweet to a collection beyond its allowed capacity will remove the oldest Tweet in the collection based on the time it was added to the collection.
     
    Use POST collections / entries / curate to add Tweets to a Collection in bulk.
 
.PARAMETER id
    The identifier of the Collection receiving the Tweet.
 
.PARAMETER tweet_id
    The identifier of the Tweet to add to the Collection.
 
.PARAMETER relative_to
    The identifier of the Tweet used for relative positioning in a curation_reverse_chron ordered collection.
 
.PARAMETER above
    Set to false to insert the specified tweet_id below the relative_to Tweet in the collection. Default: true
 
.NOTES
    This helper function was generated by the information provided here:
    https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-add
 
#>

    [CmdletBinding()]
    Param(
        [string]$id,
        [string]$tweet_id,
        [string]$relative_to,
        [string]$above
    )
    Begin {

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

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

    }
}