Public/Test-RyverAuth.ps1
function Test-RyverAuth { <# .SYNOPSIS Checks if you're authenticated. .DESCRIPTION Checks if you're authenticated. .NOTES - Troy Lindsay - Twitter: @troylindsay42 - GitHub: tlindsay42 .EXAMPLE Test-RyverAuth Checks if the default user specified by Get-PSRyverConfig is authenticated. .EXAMPLE Test-RyverAuth -Credential ( Get-Credential ) Checks if the user specified is authenticated. .EXAMPLE Test-RyverAuth -Raw Checks if the default user specified by Get-PSRyverConfig is authenticated. Returns raw output. .EXAMPLE Test-RyverAuth -Credential ( Get-Credential ) -Raw Checks if the user specified is authenticated. Returns raw output. .LINK https://tlindsay42.github.io/PSRyver/Public/Test-RyverAuth/ .LINK https://github.com/tlindsay42/PSRyver/blob/master/PSRyver/Public/Test-RyverAuth.ps1 .LINK Get-RyverAuth .FUNCTIONALITY Ryver #> [CmdletBinding()] [OutputType( [Boolean] )] [OutputType( [PSCustomObject] )] param ( <# Credentials to use for the Ryver API. Default value is the value set by Set-PSRyverConfig. #> [Parameter( Mandatory = $true, Position = 0, ValueFromPipeline = $true )] [PSCredential] $Credential, # Return raw output. [Parameter( Position = 1 )] [Switch] $Raw = $false ) begin { $function = $MyInvocation.MyCommand.Name Write-Verbose -Message ( "Beginning: '${function}' with ParameterSetName '$( $PSCmdlet.ParameterSetName )' and Parameters: " + ( $PSBoundParameters | Remove-SensitiveData | Format-Table -AutoSize | Out-String ) ) } process { $rawAuth = Get-RyverAuth @PSBoundParameters if ( $Raw ) { $rawAuth } else { $rawAuth.IsAuthenticated } } end { Write-Verbose -Message "Ending: '${function}'." } } |