Skip to content

Commit

Permalink
BugFix issue #482 allowing Component ID in New-Issue (#483)
Browse files Browse the repository at this point in the history
Co-authored-by: Michele Liberman <[email protected]>
  • Loading branch information
micheleliberman and Michele Liberman authored Jun 13, 2024
1 parent 4a64a1d commit 273e22b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
12 changes: 12 additions & 0 deletions JiraPS/Public/New-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ function New-JiraIssue {
[PSCustomObject]
$Fields,

[Parameter( ValueFromPipelineByPropertyName )]
[AllowNull()]
[String[]]
$Components,

[Parameter()]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
Expand Down Expand Up @@ -107,6 +112,13 @@ function New-JiraIssue {
}
}

if ($Components) {
$requestBody["components"] = [System.Collections.ArrayList]@()
foreach ($item in $Components) {
$null = $requestBody["components"].Add( @{ id = "$item" } )
}
}

if ($FixVersion) {
$requestBody['fixVersions'] = [System.Collections.ArrayList]@()
foreach ($item in $FixVersion) {
Expand Down
17 changes: 16 additions & 1 deletion docs/en-US/commands/New-JiraIssue.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Creates a new issue in JIRA

```powershell
New-JiraIssue [-Project] <String> [-IssueType] <String> [-Summary] <String> [[-Priority] <Int32>]
[[-Description] <String>] [[-Reporter] <String>] [[-Labels] <String[]>] [[-Parent] <String>]
[[-Description] <String>] [[-Reporter] <String>] [[-Labels] <String[]>] [[-Components] <String[]>] [[-Parent] <String>]
[[-FixVersion] <String[]>] [[-Fields] <PSCustomObject>] [[-Credential] <PSCredential>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```
Expand Down Expand Up @@ -274,6 +274,21 @@ Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Components
List of component ids which will be added to the issue.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Expand Down

0 comments on commit 273e22b

Please sign in to comment.