Public/Get-TmdsSchedule.ps1
function Get-TmdsSchedule { [CmdletBinding(DefaultParameterSetName = 'All')] [Alias('')] param ( [parameter(ParameterSetName = 'All')] [switch]$All, [parameter( ParameterSetName = 'ById', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [Alias('Id')] [int[]]$ScheduleId ) process { If ($PSCmdlet.ParameterSetName -eq 'ById') { foreach ($id in $ScheduleId) { $Resource = "schedules/$id" $params = @{ 'Resource' = $Resource 'Method' = "Get" } Invoke-TmdsApiCall @params } } Else { $Resource = "schedules" $params = @{ 'Resource' = $Resource 'Method' = "Get" } (Invoke-TmdsApiCall @params).schedules } } } |