Public/Get-JiraComment.ps1

function Get-JiraComment {
    <#
    .SYNOPSIS
        Ruft Kommentare eines Issues ab.
    .PARAMETER IssueKey
        Key oder ID des Issues, z.B. "PROJ-123".
    .PARAMETER CommentId
        ID eines einzelnen Kommentars (optional). Ohne Angabe werden alle Kommentare des Issues zurückgegeben.
    .EXAMPLE
        Get-JiraComment -IssueKey "PROJ-123"
    .EXAMPLE
        Get-JiraComment -IssueKey "PROJ-123" -CommentId 10001
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]
        $IssueKey,

        [Parameter(Mandatory = $false)]
        [string]
        $CommentId
    )

    begin {
        $ErrorActionPreference = "Stop"
    }

    process {
        if ($CommentId) {
            $response = Invoke-JiraApi -Method Get -Path "/rest/api/3/issue/$IssueKey/comment/$CommentId"
        }
        else {
            $response = (Invoke-JiraApi -Method Get -Path "/rest/api/3/issue/$IssueKey/comment").comments
        }
    }

    end {
        return $response
    }
}