public/inventory/Get-StartupProgramInventory.ps1
Function Get-StartupProgramInventory { [cmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = 'low' )] param( [Parameter( Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName )] [Alias('ProgramId')] [int] $Id, [Parameter()] [ValidatePattern("^\?")] [string] $QueryParameters ) Begin { } Process { $Endpoint = '/api/inventory/startup_programs' If ($Id) { $Endpoint = "/api/inventory/startup_programs/{0}" -f $Id } If ($PSCmdlet.ShouldProcess($Server, "GET $Endpoint")) { $newApiGETRequestSplat = @{ QueryParameters = $QueryParameters Endpoint = $Endpoint } $Result = New-ApiGETRequest @newApiGETRequestSplat } } End { $Result.StartupPrograms } } |