Public/PropertyCustomFields/New-AspirePropertyCustomField.ps1

<#
.SYNOPSIS
    Creates a new property custom field in the Aspire API.
.DESCRIPTION
    Uses Invoke-AspireRequest to perform a POST request to the /PropertyCustomFields endpoint.
.PARAMETER PropertyCustomFieldDefinitionID
    The ID of the property custom field definition (required).
.PARAMETER PropertyID
    The ID of the property (required).
.PARAMETER ColumnValue
    Optional value for the custom field (max 2000 characters).
.OUTPUTS
    The response from the API containing the result.
.EXAMPLE
    New-AspirePropertyCustomField -PropertyCustomFieldDefinitionID 1 -PropertyID 123 -ColumnValue "Example Value"
#>

function New-AspirePropertyCustomField {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [int]$PropertyCustomFieldDefinitionID,
        [Parameter(Mandatory = $true)]
        [int]$PropertyID,
        [string]$ColumnValue = $null
    )

    $body = @{
        PropertyCustomFieldDefinitionID = $PropertyCustomFieldDefinitionID
        PropertyID = $PropertyID
    }

    if ($ColumnValue) {
        $body.ColumnValue = $ColumnValue
    }

    return Invoke-AspireRequest -Method POST -Path "/PropertyCustomFields" -Body $body -ApiVersion $null
}