public/helper/Send-TwitterAccount_Settings.ps1

function Send-TwitterAccount_Settings {
<#
.SYNOPSIS
    Manage account settings and profile
 
.DESCRIPTION
    POST account/settings
     
    Updates the authenticating user's settings.
 
.PARAMETER sleep_time_enabled
    When set to true , t or 1 , will enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.
 
.PARAMETER start_sleep_time
    The hour that sleep time should begin if it is enabled. The value for this parameter should be provided in ISO 8601 format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
 
.PARAMETER end_sleep_time
    The hour that sleep time should end if it is enabled. The value for this parameter should be provided in ISO 8601 format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
 
.PARAMETER time_zone
    The timezone dates and times should be displayed in for the user. The timezone must be one of the Rails TimeZone names.
 
.PARAMETER trend_location_woeid
    The Yahoo! Where On Earth ID to use as the user's default trend location. Global information is available by using 1 as the WOEID. The WOEID must be one of the locations returned by GET trends/available .
 
.PARAMETER lang
    The language which Twitter should render in for this user. The language must be specified by the appropriate two letter ISO 639-1 representation. Currently supported languages are provided by this endpoint .
 
.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/post-account-settings
 
#>

    [CmdletBinding()]
    Param(
        [string]$sleep_time_enabled,
        [string]$start_sleep_time,
        [string]$end_sleep_time,
        [string]$time_zone,
        [string]$trend_location_woeid,
        [string]$lang
    )
    Begin {

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

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

    }
}