public/helper/Get-TwitterUsers_Suggestions_Slug.ps1
function Get-TwitterUsers_Suggestions_Slug { <# .SYNOPSIS Follow, search, and get users .DESCRIPTION Access the users in a given category of the Twitter suggested user list. It is recommended that applications cache this data for no more than one hour. .PARAMETER slug The short name of list or a category .PARAMETER lang Restricts the suggested categories to the requested language. The language must be specified by the appropriate two letter ISO 639-1 representation. Currently supported languages are provided by the GET help/languages API request. Unsupported language codes will receive English (en) results. If you use lang in this request, ensure you also include it when requesting the GET users/suggestions/:slug list. .NOTES This helper function was generated by the information provided here: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug #> [CmdletBinding()] Param( [string]$slug, [string]$lang ) Begin { [hashtable]$Parameters = $PSBoundParameters $CmdletBindingParameters | ForEach-Object { $Parameters.Remove($_) } [string]$Method = 'GET' [string]$Resource = '/users/suggestions/:slug' [string]$ResourceUrl = 'https://api.twitter.com/1.1/users/suggestions/:slug.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 { } } |