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