diff --git a/JiraPS/Public/Get-JiraComponent.ps1 b/JiraPS/Public/Get-JiraComponent.ps1 index 4374669b..57a9735d 100644 --- a/JiraPS/Public/Get-JiraComponent.ps1 +++ b/JiraPS/Public/Get-JiraComponent.ps1 @@ -56,26 +56,22 @@ function Get-JiraComponent { switch ($PSCmdlet.ParameterSetName) { "ByProject" { - if ($Project.PSObject.TypeNames -contains 'JiraPS.Project') { - Write-Output (Get-JiraComponent -ComponentId ($Project.Components).id) - } - else { - foreach ($_project in $Project) { - Write-Verbose "[$($MyInvocation.MyCommand.Name)] Processing [$_project]" - Write-Debug "[$($MyInvocation.MyCommand.Name)] Processing `$_project [$_project]" - - if ($_project -is [string]) { - $parameter = @{ - URI = $resourceURi -f "/project/$_project/components" - Method = "GET" - Credential = $Credential - } - Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter" - $result = Invoke-JiraMethod @parameter + foreach ($_project in $Project) { + Write-Verbose "[$($MyInvocation.MyCommand.Name)] Processing [$_project]" + Write-Debug "[$($MyInvocation.MyCommand.Name)] Processing `$_project [$_project]" - Write-Output (ConvertTo-JiraComponent -InputObject $result) - } + if ($_project -isnot [string]) { + $_project = $_project.Key } + $parameter = @{ + URI = $resourceURi -f "/project/$_project/components" + Method = "GET" + Credential = $Credential + } + Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter" + $result = Invoke-JiraMethod @parameter + + Write-Output (ConvertTo-JiraComponent -InputObject $result) } } "ByID" {