private/mapping/Read-ConfluenceUser.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
function Read-ConfluenceUser {
    [CmdletBinding()]
    param (
        # User object
        [Parameter(Mandatory,Position=0,ValueFromPipeline)]
        [pscustomobject]
        $Data,

        # Refresh ID
        [Parameter(Mandatory,Position=1)]
        [int]
        $RefreshId
    )
    
    begin {
    }
    
    process {
        $hostUrl = "https://" + ([System.Uri]$Data._links.self).Host
        [PSCustomObject]@{
            Account_Id = [string]$Data.accountId
            Account_Type = $Data.accountType
            Display_Name = $Data.displayName
            Public_Name = if($Data.publicName) {$Data.publicName} else {$null}
            Profile_Picture_Url = $hostUrl + $Data.profilePicture.path
            Profile_Picture_Height = $Data.profilePicture.height
            Profile_Picture_Width = $Data.profilePicture.width
            Email = $Data.email
            Refresh_Id = $RefreshId
        }
    }
    
    end {
    }
}