public/helper/Get-TwitterUsers_ProfileBanner.ps1
function Get-TwitterUsers_ProfileBanner { <# .SYNOPSIS Manage account settings and profile .DESCRIPTION GET users/profile_banner Returns a map of the available size variations of the specified user's profile banner. If the user has not uploaded a profile banner, a HTTP 404 will be served instead. This method can be used instead of string manipulation on the profile_banner_url returned in user objects as described in Profile Images and Banners. The profile banner data available at each size variant's URL is in PNG format. .PARAMETER user_id The ID of the user for whom to return results. Helpful for disambiguating when a valid user ID is also a valid screen name. .PARAMETER screen_name The screen name of the user for whom to return results. Helpful for disambiguating when a valid screen name is also a user ID. .NOTES This helper function was generated by the information provided here: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner #> [CmdletBinding()] Param( [string]$user_id, [string]$screen_name ) Begin { [hashtable]$Parameters = $PSBoundParameters $CmdletBindingParameters | ForEach-Object { $Parameters.Remove($_) } [string]$Method = 'GET' [string]$Resource = '/users/profile_banner' [string]$ResourceUrl = 'https://api.twitter.com/1.1/users/profile_banner.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 { } } |