-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFreshserviceTickets.ps1
52 lines (45 loc) · 1.3 KB
/
FreshserviceTickets.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
function Get-FreshserviceTickets {
[CmdletBinding()]
param (
[switch]$cached,
[switch]$async
)
$response = Get-FreshservicePaginated -path '/api/v2/tickets' -api 2 -cached:$cached -async:$async
return $response
}
function New-FreshserviceTicket {
# /api/v2/tickets POST
}
function Get-FreshserviceTicket {
# /api/v2/tickets/[id] GET
}
function Update-FreshserviceTicket {
# /api/v2/tickets/[id] PUT
param (
[int64]$id, #todo : make mandatory
[int64]$group_id,
$custom_fields,
$type,
$description
)
$body = @{
group_id = $group_id
custom_fields = $custom_fields
type = $type
description = $description
}
($body.GetEnumerator() | Where-Object { -not $_.Value }) | ForEach-Object { $body.Remove($_.Name) } # remove empty values from hashtable
$body = $body | ConvertTo-Json
write-host $body
$path = '/api/v2/tickets/' + $id
Invoke-FreshserviceRestMethod -Method PUT -Path $path -Body $body
}
function Remove-FreshserviceTicket {
# /api/v2/tickets/[id] DELETE
}
function Restore-FreshserviceTicket {
# /api/v2/tickets/[id]/restore GET
}
function Get-FreshserviceTicketFields {
# /api/v2/ticket_fields GET
}