public/api-v1/user/Invoke-ConfluenceGetUserGroups.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

#https://developer.atlassian.com/cloud/confluence/rest/#api-api-user-memberof-get
function Invoke-ConfluenceGetUserGroups {
    [CmdletBinding()]
    param (
        # the account id of the user to retrieve
        [Parameter(Mandatory,Position=0)]
        [string]
        $AccountId,

        # The index to start results at
        [Parameter(Position=1)]
        [int]
        $StartAt = 0,

        # The maximum number of results to return
        [Parameter(Position=2)]
        [int]
        $MaxResults = 200,

        # The AtlassianContext object to use for the request
        [Parameter()]
        [object]
        $RequestContext
    )
    begin {
        $results = @()
    }
    process {
        $functionPath = "/wiki/rest/api/user/memberof"
        $verb = "GET"

        $query = New-PACRestMethodQueryParams @{
            accountId = $AccountId
            start = $StartAt
            limit = $MaxResults
        }

        $method = New-PACRestMethod $functionPath $verb $query
        $results += $method.Invoke($RequestContext)
    }
    end {
        $results
    }
}