Public/Get-ZomentumTaxCategory.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
function Get-ZomentumTaxCategory {
     <#
        .SYNOPSIS
            Gets Tax categories from the Zomentum API.
        .DESCRIPTION
            Retrieves Tax categories from the Zomentum API - supports a variety of filtering parameters.
        .OUTPUTS
            A powershell object containing the response.
    #>

    [CmdletBinding()]
    Param(
        # Tax ID for retrieving a single Tax Category
        [Parameter( ParameterSetName = 'Single', Mandatory = $True )]
        [string]$TaxCatID,
        # An Object containing filter variables
        [Parameter( ParameterSetName = 'Multiple')]
        [PSCustomObject]$Filters
    )
  
    if ($TaxCatID) {
        Write-Verbose "Fetching Single Tax Category"
        $TaxCats = Invoke-ZomentumRequest -method get -resource "tax/categories/$TaxCatID"
    } else {
        Write-Verbose "Fetching Multiple Tax Categories"
        $TaxCats = Invoke-ZomentumRequest -method get -resource "tax/categories" -Filters $Filters -MultiFetch
    }
    return $TaxCats
  
}