This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Get-GitLabProjectIssueNote.ps1
64 lines (56 loc) · 1.74 KB
/
Get-GitLabProjectIssueNote.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function Get-GitLabProjectIssueNote
{
<#
.SYNOPSIS
Get Issue Note
.DESCRIPTION
Get note for specified issue.
Returnes all notes by default, Specify -NoteID to return single note.
.EXAMPLE
Get-GitLabProjectIssueNote -ProjectID 20 -IssueID 1
---------------------------------------------------------------
get all notes for project 20 and issue 1
.EXAMPLE
Get-GitLabProjectIssueNote -ProjectID 20 -IssueID 1 -NoteID 3
---------------------------------------------------------------
gets note 3 for project 20 and issue 1
#>
[CmdletBinding(DefaultParameterSetName = 'AllNotes')]
[Alias()]
[OutputType()]
Param
(
#The ID of a project
[Parameter(HelpMessage = 'ProjectID',
Mandatory = $true)]
[Alias('ID')]
[String]$ProjectID,
#The ID of a projects issue
[Parameter(HelpMessage = 'IssueID',
Mandatory = $true)]
[string]$IssueID,
#The ID of a issues note
[Parameter(ParameterSetName = 'SingleNote',
HelpMessage = 'NoteID',
Mandatory = $true)]
[Alias('note_id')]
[string]$NoteID,
# Existing GitlabConnector Object, can be retrieved with Get-GitlabConnect
[Parameter(HelpMessage = 'Specify Existing GitlabConnector',
Mandatory = $false,
DontShow = $true)]
[psobject]$GitlabConnect = (Get-GitlabConnect)
)
$httpmethod = 'get'
$apiurl = "projects/$([System.Web.HttpUtility]::UrlEncode($projectId))/issues/$IssueID/notes"
$parameters = @{}
if($PSCmdlet.ParameterSetName -like 'AllNotes')
{
#no further action required
}
if($PSCmdlet.ParameterSetName -like 'SingleNote')
{
$apiurl += "/$NoteID"
}
$GitlabConnect.callapi($apiurl,$httpmethod,$parameters)
}