public/helper/Send-TwitterStatuses_Filter.ps1

function Send-TwitterStatuses_Filter {
<#
.SYNOPSIS
    Filter realtime Tweets

.DESCRIPTION
    POST statuses/filter
    
    Returns public statuses that match one or more filter predicates. Multiple parameters may be specified which allows most clients to use a single connection to the Streaming API. Both GET and POST requests are supported, but GET requests with too many parameters may cause the request to be rejected for excessive URL length. Use a POST request to avoid long URLs.
    
    The track, follow, and locations fields should be considered to be combined with an OR operator. track=foo&follow=1234 returns Tweets matching "foo" OR created by user 1234.
    
    The default access level allows up to 400 track keywords, 5,000 follow userids and 25 0.1-360 degree location boxes. If you need access to more rules and filtering tools, please apply for enterprise access.

.PARAMETER follow
    A comma separated list of user IDs, indicating the users to return statuses for in the stream. See follow for more information.

.PARAMETER track
    Keywords to track. Phrases of keywords are specified by a comma-separated list. See track for more information.

.PARAMETER locations
    Specifies a set of bounding boxes to track. See locations for more information.

.PARAMETER delimited
    Specifies whether messages should be length-delimited. See delimited for more information.

.PARAMETER stall_warnings
    Specifies whether stall warnings should be delivered. See stall_warnings for more information.

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

#>

    [CmdletBinding()]
    Param(
        [string]$follow,
        [string]$track,
        [string]$locations,
        [string]$delimited,
        [string]$stall_warnings
    )
    Begin {

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

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

    }
}