Functions/Set-IACategory.ps1

Function Set-IACategory {
    <#
        .SYNOPSIS
            This is used to change a Category.
        .DESCRIPTION
            This function is used to change the properties of a Category.
        .EXAMPLE
            Get-IACategory -All
 
            $IACategory = Get-IACategory -Name 'Business Category'
 
            $IACategory.Description = 'This is a pretty good category!'
 
            Set-IACategory -IACategory $IACategory
    #>

    Param(
        [Parameter(Mandatory = $true)]
        [PSObject] $IACategory
    )
    $Uri = "Categories($($IACategory.Id))"
    
    $Body = $IACategory | ConvertTo-Json

    Write-Verbose "Body: $Body"

    $response = Invoke-IAQuery -QueryUrl $Uri -Method Patch -Body $Body
    if ($null -eq $response.value) {
        return $null
    }

    return $response.value
}