Functions/Set-IAWidget.ps1

Function Set-IAWidget {
    <#
        .SYNOPSIS
            This is used to change a Widget.
        .DESCRIPTION
            This function is used to change the properties of a Widget.
        .EXAMPLE
            $IAWidget = Get-IAWidget -Id '1922ef57-bd02-4433-ca16-08d7726d4ac0'
            $IAWidget.HyperlinkUri = 'http://www.testURL.com'
 
            Set-IAWidget -IAWidget $IAWidget
    #>

    Param(
        [Parameter(Mandatory = $true)]
        [PSObject] $IAWidget
    )
    $Uri = "Widgets($($IAWidget.Id))"
    
    $Body = $IAWidget | 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
}