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
/
Copy pathSet-GitLabProjectIssueNote.ps1
73 lines (63 loc) · 2.1 KB
/
Set-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
65
66
67
68
69
70
71
72
73
function Set-GitLabProjectIssueNote
{
<#
.SYNOPSIS
Modify an Existing Note on an issue.
.DESCRIPTION
The Set-GitLabProjectIssueNote function modifies an existing note on an issue.
You can retrieve note ids using Get-GitLabProjectIssueNote.
when -PassThru is specified the modified note is returned.
.EXAMPLE
Set-GitLabProjectIssueNote -ProjectID 20 -IssueID 15 -NoteID 1 -Body 'Interresting Comment'
---------------------------------------------------------------
Sets the content of note 1 on issue 15 for project 20 to 'Interresting Comment'
.EXAMPLE
Set-GitLabProjectIssueNote -ProjectID 20 -IssueID 15 -NoteID 1 -Body 'Interresting Comment' -PassThru
---------------------------------------------------------------
Sets the content of note 1 on issue 15 for project 20 to 'Interresting Comment'
Returns the modified Note.
#>
[CmdletBinding()]
[Alias()]
[OutputType()]
Param
(
#The ID of the project
[Parameter(HelpMessage = 'ProjectID',
Mandatory = $true)]
[Alias('ID')]
[int]$ProjectID,
#The ID of a projects issue
[Parameter(HelpMessage = 'IssueID',
Mandatory = $true)]
[string]$IssueID,
#The ID of the issues Note
[Parameter(HelpMessage = 'NoteID',
Mandatory = $true)]
[Alias('note_id')]
[string]$NoteID,
#The content of a note
[Parameter(HelpMessage = 'The content of a note',
Mandatory = $true)]
[string]$Body,
# Existing GitlabConnector Object, can be retrieved with Get-GitlabConnect
[Parameter(HelpMessage = 'Specify Existing GitlabConnector',
Mandatory = $false,
DontShow = $true)]
[psobject]$GitlabConnect = (Get-GitlabConnect),
# Return the modified issue note
[Parameter(HelpMessage = 'Passthru the modified issue note',
Mandatory = $false)]
[switch]$PassThru
)
$httpmethod = 'put'
$apiurl = "projects/$ProjectID/issues/$IssueID/notes/$NoteID"
$parameters = @{
body = $body
}
$newnote = $GitlabConnect.callapi($apiurl,$httpmethod,$parameters)
if($PassThru)
{
return $newnote
}
}