This repository was 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
Expand file tree
/
Copy pathNew-GitLabProjectIssueNote.ps1
More file actions
74 lines (64 loc) · 1.99 KB
/
Copy pathNew-GitLabProjectIssueNote.ps1
File metadata and controls
74 lines (64 loc) · 1.99 KB
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
74
function New-GitLabProjectIssueNote
{
<#
.SYNOPSIS
Adds a single note to an issue
.DESCRIPTION
The New-GitLabProjectIssueNote function adds a single note to an issue.
.EXAMPLE
New-GitLabProjectIssueNote -ProjectID 20 -IssueID 1 -Body 'Started research'
---------------------------------------------------------------
Adds a new note reading 'Started research' to issue 1 in project 20
.EXAMPLE
New-GitLabProjectIssueNote -ProjectID 20 -IssueID 1 -Body 'Started research' -PassThru
---------------------------------------------------------------
Adds a new note reading 'Started research' to issue 1 in project 20 and returns the newly created note.
#>
[CmdletBinding()]
[Alias()]
[OutputType()]
Param
(
# The ID of the project
[Parameter(HelpMessage = 'ProjectID',
Mandatory = $true)]
[Alias('ID')]
[int]$ProjectID,
# The ID of the projects issue
[Parameter(HelpMessage = 'IssueID',
Mandatory = $true)]
[string]$IssueID,
# The content of the note
[Parameter(HelpMessage = 'The content of a note',
Mandatory = $true)]
[string]$Body,
# The time the note was created
[Parameter(HelpMessage = 'time of creation',
Mandatory = $false)]
[Alias('created_at')]
[DateTime]$CreatedAt,
# Specify Existing GitlabConnector
[Parameter(HelpMessage = 'Specify Existing GitlabConnector',
Mandatory = $false,
DontShow = $true)]
[psobject]$GitlabConnect = (Get-GitlabConnect),
# Passthru the created label
[Parameter(HelpMessage = 'Passthru the created label',
Mandatory = $false)]
[switch]$PassThru
)
$httpmethod = 'post'
$apiurl = "projects/$ProjectID/issues/$IssueID/notes"
$parameters = @{
body = $body
}
if($CreatedAt)
{
$parameters.'created_at' = $CreatedAt.ToUniversalTime().tostring('s') +'Z'
}
$newnote = $GitlabConnect.callapi($apiurl,$httpmethod,$parameters)
if($PassThru)
{
return $newnote
}
}