public/api-v1/content/Invoke-ConfluenceGetContentLabels.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
53
54
#https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-history-version-macro-id-macroId-get
function Invoke-ConfluenceGetContentLabels {
    [CmdletBinding()]
    param (
        # The id of the content
        [Parameter(Mandatory,Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)]
        [Alias("Id")]
        [int32]
        $ContentId,

        # The scope/prefix of the labels to be returned
        [Parameter(Position=1,ValueFromPipelineByPropertyName)]
        [Alias("Prefix")]
        [ValidateSet("global","my","team")]
        [string]
        $Scope,

        # The index of the first item to return in the page of results (page offset). The base index is 0.
        [Parameter(Position=2)]
        [int32]
        $StartAt=0,

        # The maximum number of items to return per page. The default is 200 and the maximum is 200.
        [Parameter(Position=3)]
        [ValidateRange(1,200)]
        [int32]
        $MaxResults=200,

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

        $query = New-PACRestMethodQueryParams @{
            start = $StartAt
            limit = $MaxResults
        }
        if($PSBoundParameters.ContainsKey("Scope")){$query.Add("prefix",$Scope)}

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