From a70ddc56174a86c21fe669dfe03159d7677b97d9 Mon Sep 17 00:00:00 2001 From: Michele Liberman Date: Mon, 26 Jun 2023 00:26:01 +0100 Subject: [PATCH] BugFix issue #482 allowing Component ID in New-Issue --- JiraPS/Public/New-JiraIssue.ps1 | 12 ++++++++++++ docs/en-US/commands/New-JiraIssue.md | 17 ++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/JiraPS/Public/New-JiraIssue.ps1 b/JiraPS/Public/New-JiraIssue.ps1 index 9f3eca6a..e8fa49b0 100644 --- a/JiraPS/Public/New-JiraIssue.ps1 +++ b/JiraPS/Public/New-JiraIssue.ps1 @@ -45,6 +45,11 @@ function New-JiraIssue { [PSCustomObject] $Fields, + [Parameter( ValueFromPipelineByPropertyName )] + [AllowNull()] + [String[]] + $Components, + [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] @@ -111,6 +116,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) { diff --git a/docs/en-US/commands/New-JiraIssue.md b/docs/en-US/commands/New-JiraIssue.md index 775e880e..c8abf675 100644 --- a/docs/en-US/commands/New-JiraIssue.md +++ b/docs/en-US/commands/New-JiraIssue.md @@ -17,7 +17,7 @@ Creates a new issue in JIRA ```powershell New-JiraIssue [-Project] [-IssueType] [-Summary] [[-Priority] ] - [[-Description] ] [[-Reporter] ] [[-Labels] ] [[-Parent] ] + [[-Description] ] [[-Reporter] ] [[-Labels] ] [[-Components] ] [[-Parent] ] [[-FixVersion] ] [[-Fields] ] [[-Credential] ] [-WhatIf] [-Confirm] [] ``` @@ -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