Public/Get-LaunchLibraryEndpoint.ps1
|
function Get-LaunchLibraryEndpoint { <# .SYNOPSIS Lists all 116 GET operations in Launch Library API 2.3.0. #> [CmdletBinding()] param([string]$Name) $operations = foreach ($resource in $script:LaunchLibraryResources) { if ($resource.SupportsScope) { foreach ($scope in @('All', 'Previous', 'Upcoming')) { $scopePath = if ($scope -eq 'All') { $resource.Path } else { '{0}{1}/' -f $resource.Path, $scope.ToLowerInvariant() } [pscustomobject]@{ Name = $resource.Name; Scope = $scope; Method = 'GET'; Path = $scopePath; Operation = 'List'; Command = $resource.Command } [pscustomobject]@{ Name = $resource.Name; Scope = $scope; Method = 'GET'; Path = '{0}{1}/' -f $scopePath, '{id}'; Operation = 'Retrieve'; Command = $resource.Command } } } else { [pscustomobject]@{ Name = $resource.Name; Scope = 'All'; Method = 'GET'; Path = $resource.Path; Operation = 'List'; Command = $resource.Command } if ($resource.SupportsId) { [pscustomobject]@{ Name = $resource.Name; Scope = 'All'; Method = 'GET'; Path = '{0}{1}/' -f $resource.Path, '{id}'; Operation = 'Retrieve'; Command = $resource.Command } } } } if ($Name) { $operations | Where-Object { $_.Name -like "*$Name*" -or $_.Path -like "*$Name*" } } else { $operations } } |