forked from gildas/posh-ic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Get-ICSchedule.ps1
47 lines (39 loc) · 1.43 KB
/
Get-ICSchedule.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
<#
# AUTHOR : Paul McGurn
#>
function Get-ICSchedule() {
<#
.SYNOPSIS
Gets a list of all schedules
.DESCRIPTION
Gets a list of all schedules
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER Properties
Return specific properties instead of all properties
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)] [Alias("Session", "Id")] $ICSession,
[Parameter(Mandatory = $true)] [Alias("Schedule")] $ICSchedule,
[Parameter(Mandatory = $false)] [Alias("Fields", "Columns")] $Properties
)
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
#default URI to pull just base User objects for performance
$uri = "$($ICsession.baseURL)/$($ICSession.id)/configuration/schedules/${ICSchedule}?select=*"
#we'll use the supplied properties (can be "*") to get detailed results, if the param was supplied
if (![String]::IsNullOrEmpty($properties)) {
Write-Verbose "Called with specific properties, will use 'select' querystring"
$uri = "$($ICsession.baseURL)/$($ICSession.id)/configuration/schedules/$ICSchedule?select=${properties}"
}
$response = Invoke-RestMethod -Uri $uri `
-Method Get `
-Headers $headers `
-WebSession $ICSession.webSession `
-ResponseHeadersVariable responseheaders `
-ErrorAction Stop
return $response
}