-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGet-ICUserStatus.ps1
More file actions
40 lines (37 loc) · 1.02 KB
/
Get-ICUserStatus.ps1
File metadata and controls
40 lines (37 loc) · 1.02 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
<#
# AUTHOR : Gildas Cherruel
#>
function Get-ICUserStatus() # {{{2
{
# Documentation {{{3
<#
.SYNOPSIS
Gets the status of the given user
.DESCRIPTION
Gets the status of the given user. If no user is given, the connected user will be used
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER ICUser
The Interaction Center User
#> # }}}3
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[Alias("Session", "Id")]
[ININ.ICSession] $ICSession,
[Parameter(Mandatory=$false)]
[Alias("User")]
[ININ.ICUser] $ICUser
)
if (! $PSBoundParameters.ContainsKey('ICUser'))
{
$ICUser = $ICSession.user
}
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
$response = Invoke-RestMethod -Uri "$($ICsession.baseURL)/$($ICSession.id)/status/user-statuses/$($ICUser.id)" -Method Get -Headers $headers -WebSession $ICSession.webSession -ErrorAction Stop
Write-Output $response | Format-Table
[PSCustomObject] $response
} # }}}2