Public/Build-ConnectorOperation.ps1

function Build-ConnectorOperation {
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param (
        [Parameter(Mandatory = $true)]
        [ValidateSet("Create", "Update", "Delete")]
        [string] $OperationType,
        
        [Parameter(Mandatory = $false)]
        [string] $Id,

        [Parameter(Mandatory = $true)]
        [System.Collections.Hashtable] $ConnectorObject
    ) 
    
    process {
        if($OperationType -in "Update", "Delete") {
            if([string]::IsNullOrEmpty($Id)) {
                throw "Operation $OperationType requires an Id"
            }
        }
        @{
            Id              = [string]::IsNullOrEmpty($Id) ? $null : $Id
            OperationType   = $OperationType
            ConnectorObject = $ConnectorObject
        }
    }
}